Cleanup code, improve typings

This commit is contained in:
ErickSkrauch
2019-12-13 22:27:13 +03:00
parent 830a17612b
commit d9ef27b745
28 changed files with 189 additions and 225 deletions

View File

@ -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

View File

@ -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.");
}