Update login() method

This commit is contained in:
Visman 2021-02-11 18:27:01 +07:00
parent 210474637b
commit b3a617b3b2
2 changed files with 4 additions and 4 deletions

View file

@ -47,7 +47,7 @@ class Auth extends Page
/** /**
* Вход на форум * Вход на форум
*/ */
public function login(array $args, string $method): Page public function login(array $args, string $method, string $username = ''): Page
{ {
$this->c->Lang->load('validator'); $this->c->Lang->load('validator');
$this->c->Lang->load('auth'); $this->c->Lang->load('auth');
@ -98,7 +98,7 @@ class Auth extends Page
$this->titles = __('Login'); $this->titles = __('Login');
$this->regLink = '1' == $this->c->config->o_regs_allow ? $this->c->Router->link('Register') : null; $this->regLink = '1' == $this->c->config->o_regs_allow ? $this->c->Router->link('Register') : null;
$username = $v ? $v->username : ($args['_username'] ?? ''); $username = $v ? $v->username : $username;
$save = $v ? $v->save : 1; $save = $v ? $v->save : 1;
$redirect = $v ? $v->redirect : $this->c->Router->validate($ref, 'Index'); $redirect = $v ? $v->redirect : $this->c->Router->validate($ref, 'Index');
$this->form = $this->formLogin($username, $save, $redirect); $this->form = $this->formLogin($username, $save, $redirect);

View file

@ -272,7 +272,7 @@ class Register extends Page
$auth = $this->c->Auth; $auth = $this->c->Auth;
$auth->fIswev = ['s', __('Reg complete')]; $auth->fIswev = ['s', __('Reg complete')];
return $auth->login(['_username' => $v->username], 'GET'); return $auth->login([], 'GET', $v->username);
} }
} }
@ -309,6 +309,6 @@ class Register extends Page
$auth = $this->c->Auth; $auth = $this->c->Auth;
$auth->fIswev = ['s', __('Reg complete')]; $auth->fIswev = ['s', __('Reg complete')];
return $auth->login(['_username' => $user->username], 'GET'); return $auth->login([], 'GET', $user->username);
} }
} }