mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Auth: Fix bug in user registration
Due to fact that the automatically generated setEmail method is replaced by the method for a complete change of email address, which runs the save method. Because of this, in case of an error, the user will still be created. This commit renames the method for completely changing email address to avoid replacing the automatically generated method.
This commit is contained in:
parent
63d6de7eec
commit
aef369ac58
2 changed files with 3 additions and 3 deletions
|
@ -877,7 +877,7 @@ class User extends RowModel
|
|||
return true;
|
||||
}
|
||||
|
||||
function setEmail(string $email): void
|
||||
function changeEmail(string $email): void
|
||||
{
|
||||
DatabaseConnection::i()->getContext()->table("ChandlerUsers")
|
||||
->where("id", $this->getChandlerUser()->getId())->update([
|
||||
|
|
|
@ -360,7 +360,7 @@ final class UserPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
try {
|
||||
$user->setEmail($this->postParam("new_email"));
|
||||
$user->changeEmail($this->postParam("new_email"));
|
||||
} catch(UniqueConstraintViolationException $ex) {
|
||||
$this->flashFail("err", tr("error"), tr("user_already_exists"));
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ final class UserPresenter extends OpenVKPresenter
|
|||
$request->delete(false);
|
||||
|
||||
try {
|
||||
$request->getUser()->setEmail($request->getNewEmail());
|
||||
$request->getUser()->changeEmail($request->getNewEmail());
|
||||
} catch(UniqueConstraintViolationException $ex) {
|
||||
$this->flashFail("err", tr("error"), tr("user_already_exists"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue