mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Cleanup code, improve typings
This commit is contained in:
@ -75,10 +75,7 @@ class AuthenticationForm extends ApiForm {
|
||||
|
||||
// The previous authorization server implementation used the nickname field instead of username,
|
||||
// so we keep such behavior
|
||||
$attribute = $loginForm->getLoginAttribute();
|
||||
if ($attribute === 'username') {
|
||||
$attribute = 'nickname';
|
||||
}
|
||||
$attribute = strpos($this->username, '@') === false ? 'nickname' : 'email';
|
||||
|
||||
// TODO: эта логика дублируется с логикой в SignoutForm
|
||||
|
||||
|
@ -47,10 +47,7 @@ class SignoutForm extends ApiForm {
|
||||
|
||||
// The previous authorization server implementation used the nickname field instead of username,
|
||||
// so we keep such behavior
|
||||
$attribute = $loginForm->getLoginAttribute();
|
||||
if ($attribute === 'username') {
|
||||
$attribute = 'nickname';
|
||||
}
|
||||
$attribute = strpos($this->username, '@') === false ? 'nickname' : 'email';
|
||||
|
||||
throw new ForbiddenOperationException("Invalid credentials. Invalid {$attribute} or password.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user