diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index 1314a1a4..c2993928 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -3,7 +3,7 @@ namespace openvk\Web\Presenters; use openvk\Web\Models\Entities\{Club, Photo}; use openvk\Web\Models\Entities\Notifications\ClubModeratorNotification; use openvk\Web\Models\Repositories\{Clubs, Users, Albums, Managers}; - +use Chandler\Security\Authenticator; final class GroupPresenter extends OpenVKPresenter { private $clubs; @@ -275,12 +275,19 @@ final class GroupPresenter extends OpenVKPresenter $this->assertUserLoggedIn(); $this->willExecuteWriteAction(); + if($_SERVER['REQUEST_METHOD'] !== "POST") + $this->redirect("/groups".$this->user->id); + + if(!Authenticator::verifyHash($this->postParam("password"), $this->user->identity->getChandlerUser()->getRaw()->passwordHash)) + $this->flashFail("err", tr("error"), tr("incorrect_password")); + $club = $this->clubs->get($id); $newOwner = (new Users)->get($newOwnerID); if($this->user->id !== $club->getOwner()->getId()) $this->flashFail("err", tr("error"), tr("forbidden")); $club->setOwner($newOwnerID); + $club->addManager($this->user->id); $club->save(); $this->flashFail("succ", tr("information_-1"), tr("group_owner_setted", $newOwner->getCanonicalName(), $club->getName())); diff --git a/Web/Presenters/templates/Group/Followers.xml b/Web/Presenters/templates/Group/Followers.xml index 114b2228..94c493e6 100644 --- a/Web/Presenters/templates/Group/Followers.xml +++ b/Web/Presenters/templates/Group/Followers.xml @@ -93,7 +93,7 @@ {if $club->getOwner()->getId() != $user->getId() && $manager && $thisUser->getId() == $club->getOwner()->getId()} | - + {_promote_to_owner} {/if} @@ -122,4 +122,25 @@ + + {/block} diff --git a/locales/en.strings b/locales/en.strings index c4fefeb9..1de23164 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -241,7 +241,7 @@ "group_display_all_administrators" = "Display all administrators"; "group_dont_display_administrators_list" = "Display nothing"; -"group_owner_setted" = "New owner ($1) has been successfully assigned to community $2. If you want to return the community, please contact the technical support of the site."; +"group_owner_setted" = "The new owner ($1) has been successfully assigned to the community $2. You have been granted administrator rights in the community. If you want to return the owner role, contact site technical support."; "participants_zero" = "No participants"; "participants_one" = "$1 participant"; diff --git a/locales/ru.strings b/locales/ru.strings index 9b237f4d..d49b5c0b 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -251,7 +251,7 @@ "group_display_all_administrators" = "Отображать всех администраторов"; "group_dont_display_administrators_list" = "Ничего не отображать"; -"group_owner_setted" = "Новый владелец ($1) успешно назначен в сообщество $2. Если Вы хотите вернуть сообщество, обратитесь в техническую поддержку сайта."; +"group_owner_setted" = "Новый владелец ($1) успешно назначен в сообщество $2. Вам выданы права администратора в сообществе. Если Вы хотите вернуть роль владельца, обратитесь в техническую поддержку сайта."; "participants_zero" = "Ни одного участника"; "participants_one" = "Один участник";