registration bug
This commit is contained in:
parent
f913d8e4a3
commit
2590d62f1f
@ -97,11 +97,8 @@ class UserRegister
|
||||
if ($isRegistered || $wasRegistered || $isRestricted) {
|
||||
$this->error = 'Логин ' . $login . ' уже занят, выберите другой.';
|
||||
}
|
||||
if (!$this->error) {
|
||||
$this->login = $login;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function hasGoodEmail(string $email): bool
|
||||
@ -118,11 +115,7 @@ class UserRegister
|
||||
if (!in_array(explode('@', $email)[1], $allowedDomains)) {
|
||||
$this->error = 'Данный почтовый сервис использовать нельзя.';
|
||||
}
|
||||
if (!$this->error) {
|
||||
$this->email = $email;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function hasGoodEmailCode(string $email, int $code): bool
|
||||
@ -144,25 +137,17 @@ class UserRegister
|
||||
if (strlen($password1) < 8) {
|
||||
$this->error = 'Пароль должен быть больше 8 символов';
|
||||
}
|
||||
if (!$this->error) {
|
||||
$this->password = password_hash($password1, PASSWORD_DEFAULT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function new($ref, $birthday, int $sex, int $class): string
|
||||
public function new(string $login, string $password, string $email, $ref, $birthday, int $sex, int $class): string
|
||||
{
|
||||
if (!$this->login ||
|
||||
!$this->password ||
|
||||
!$this->email ||
|
||||
!in_array($sex, [10, 11]) ||
|
||||
!in_array($class, range(1, 9))) {
|
||||
if (!$this->hasGoodLogin()) {
|
||||
return 0;
|
||||
}
|
||||
$this->class = $class;
|
||||
$ip = UserIp::get();
|
||||
$sex = (int)$sex - 10; //На входе 10\11, а передать надо 0\1.
|
||||
$sex -= 10; //На входе 10\11, а передать надо 0\1.
|
||||
Db::sql(
|
||||
'insert into users
|
||||
(`real`,login,host_reg,pass,ip,ipreg,room,timereg,mail,bithday,sex,fnq,molch2,level,clan_zv,money,online)
|
||||
@ -179,6 +164,7 @@ class UserRegister
|
||||
]
|
||||
);
|
||||
$uid = Db::lastInsertId();
|
||||
$this->login = $login;
|
||||
$this->setCookies();
|
||||
$this->setStatsItemsEffects();
|
||||
User::setOnline($uid);
|
||||
@ -190,7 +176,7 @@ class UserRegister
|
||||
{
|
||||
setcookie('login', 1, 1, '/', Config::get('host'), true);
|
||||
setcookie('registrationModal', 1, 1, '/', Config::get('host'), true);
|
||||
setrawcookie('login', $this->login, strtotime('+7 days'), '/', Config::get('host'), true);
|
||||
setcookie('login', $this->login, strtotime('+7 days'), '/', Config::get('host'), true);
|
||||
setcookie('registrationModal', 'true', strtotime('+7 days'), '/', Config::get('host'), true);
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,9 @@ if ($_SESSION['step'] === 8) { // Всех их соберём, вместе с
|
||||
//Создаем персонажа
|
||||
|
||||
$uid = $newUser->new(
|
||||
$_SESSION['login'],
|
||||
$_SESSION['password'],
|
||||
$_SESSION['email'],
|
||||
$_SESSION['ref'],
|
||||
$_SESSION['birthday'],
|
||||
$_SESSION['sex'],
|
||||
|
Loading…
Reference in New Issue
Block a user