mirror of
https://github.com/openvk/openvk
synced 2024-12-23 09:01:15 +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\User;
|
||||||
use openvk\Web\Models\Entities\PasswordReset;
|
use openvk\Web\Models\Entities\PasswordReset;
|
||||||
use openvk\Web\Models\Entities\EmailVerification;
|
use openvk\Web\Models\Entities\EmailVerification;
|
||||||
|
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||||
use openvk\Web\Models\Repositories\IPs;
|
use openvk\Web\Models\Repositories\IPs;
|
||||||
use openvk\Web\Models\Repositories\Users;
|
use openvk\Web\Models\Repositories\Users;
|
||||||
use openvk\Web\Models\Repositories\Restores;
|
use openvk\Web\Models\Repositories\Restores;
|
||||||
|
@ -88,12 +89,8 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
if (strtotime($this->postParam("birthday")) > time())
|
if (strtotime($this->postParam("birthday")) > time())
|
||||||
$this->flashFail("err", tr("invalid_birth_date"), tr("invalid_birth_date_comment"));
|
$this->flashFail("err", tr("invalid_birth_date"), tr("invalid_birth_date_comment"));
|
||||||
|
|
||||||
$chUser = ChandlerUser::create($this->postParam("email"), $this->postParam("password"));
|
try {
|
||||||
if(!$chUser)
|
|
||||||
$this->flashFail("err", tr("failed_to_register"), tr("user_already_exists"));
|
|
||||||
|
|
||||||
$user = new User;
|
$user = new User;
|
||||||
$user->setUser($chUser->getId());
|
|
||||||
$user->setFirst_Name($this->postParam("first_name"));
|
$user->setFirst_Name($this->postParam("first_name"));
|
||||||
$user->setLast_Name($this->postParam("last_name"));
|
$user->setLast_Name($this->postParam("last_name"));
|
||||||
$user->setSex((int)($this->postParam("sex") === "female"));
|
$user->setSex((int)($this->postParam("sex") === "female"));
|
||||||
|
@ -102,6 +99,15 @@ final class AuthPresenter extends OpenVKPresenter
|
||||||
$user->setRegistering_Ip(CONNECTING_IP);
|
$user->setRegistering_Ip(CONNECTING_IP);
|
||||||
$user->setBirthday(strtotime($this->postParam("birthday")));
|
$user->setBirthday(strtotime($this->postParam("birthday")));
|
||||||
$user->setActivated((int)!OPENVK_ROOT_CONF['openvk']['preferences']['security']['requireEmail']);
|
$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();
|
$user->save();
|
||||||
|
|
||||||
if(!is_null($referer)) {
|
if(!is_null($referer)) {
|
||||||
|
|
Loading…
Reference in a new issue