Added login via email/password

This commit is contained in:
Visman 2023-05-29 21:05:45 +07:00
parent 8e41ecb415
commit cdb41fa93c
3 changed files with 14 additions and 2 deletions

View file

@ -175,7 +175,7 @@ class Auth extends Page
'autofocus' => true,
'type' => 'text',
'value' => $username,
'caption' => 'Username',
'caption' => 'Username or email',
'required' => true,
],
'password' => [
@ -209,7 +209,13 @@ class Auth extends Page
{
if (empty($v->getErrors())) {
if ($this->loginWithForm) {
$this->userAfterLogin = $this->c->users->loadByName($v->username);
if (\strpos($v->username, '@')) {
$this->userAfterLogin = $this->c->users->loadByEmail($v->username);
}
if (! $this->userAfterLogin instanceof User) {
$this->userAfterLogin = $this->c->users->loadByName($v->username);
}
}
if (

View file

@ -65,3 +65,6 @@ msgstr "Your passphrase has been updated. You can now login with your new passph
msgid "Account activated"
msgstr "Account activated."
msgid "Username or email"
msgstr "Username or email"

View file

@ -65,3 +65,6 @@ msgstr "Ваша кодовая фраза изменена. Вы можете
msgid "Account activated"
msgstr "Аккаунт активирован."
msgid "Username or email"
msgstr "Имя или почта"