mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
parent
c4a0d5ed98
commit
6966cbb8c5
1 changed files with 16 additions and 10 deletions
|
@ -4,6 +4,7 @@ use openvk\Web\Models\Entities\IP;
|
|||
use openvk\Web\Models\Entities\User;
|
||||
use openvk\Web\Models\Entities\PasswordReset;
|
||||
use openvk\Web\Models\Entities\EmailVerification;
|
||||
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||
use openvk\Web\Models\Repositories\IPs;
|
||||
use openvk\Web\Models\Repositories\Users;
|
||||
use openvk\Web\Models\Repositories\Restores;
|
||||
|
@ -88,12 +89,8 @@ final class AuthPresenter extends OpenVKPresenter
|
|||
if (strtotime($this->postParam("birthday")) > time())
|
||||
$this->flashFail("err", tr("invalid_birth_date"), tr("invalid_birth_date_comment"));
|
||||
|
||||
$chUser = ChandlerUser::create($this->postParam("email"), $this->postParam("password"));
|
||||
if(!$chUser)
|
||||
$this->flashFail("err", tr("failed_to_register"), tr("user_already_exists"));
|
||||
|
||||
try {
|
||||
$user = new User;
|
||||
$user->setUser($chUser->getId());
|
||||
$user->setFirst_Name($this->postParam("first_name"));
|
||||
$user->setLast_Name($this->postParam("last_name"));
|
||||
$user->setSex((int)($this->postParam("sex") === "female"));
|
||||
|
@ -102,6 +99,15 @@ final class AuthPresenter extends OpenVKPresenter
|
|||
$user->setRegistering_Ip(CONNECTING_IP);
|
||||
$user->setBirthday(strtotime($this->postParam("birthday")));
|
||||
$user->setActivated((int)!OPENVK_ROOT_CONF['openvk']['preferences']['security']['requireEmail']);
|
||||
} catch(InvalidUserNameException $ex) {
|
||||
$this->flashFail("err", tr("error"), tr("invalid_real_name"));
|
||||
}
|
||||
|
||||
$chUser = ChandlerUser::create($this->postParam("email"), $this->postParam("password"));
|
||||
if(!$chUser)
|
||||
$this->flashFail("err", tr("failed_to_register"), tr("user_already_exists"));
|
||||
|
||||
$user->setUser($chUser->getId());
|
||||
$user->save();
|
||||
|
||||
if(!is_null($referer)) {
|
||||
|
|
Loading…
Reference in a new issue