From 2239845a00bebca2e006d11b9dbae2f83241cbb8 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Thu, 11 Nov 2021 12:30:42 +0000 Subject: [PATCH] [CONTROLLER][Security] Remove nickname normalization when trying to login --- src/Security/Authenticator.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 73d0b03464..701c28da06 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -26,8 +26,7 @@ use App\Core\Router\Router; use App\Entity\LocalUser; use App\Entity\User; use App\Util\Exception\NoSuchActorException; -use App\Util\Nickname; -use Exception; +use App\Util\Exception\NotFoundException; use Stringable; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -103,13 +102,13 @@ class Authenticator extends AbstractFormLoginAuthenticator if (filter_var($credentials['nickname_or_email'], \FILTER_VALIDATE_EMAIL) !== false) { $user = LocalUser::getByEmail($credentials['nickname_or_email']); } else { - $user = LocalUser::getByNickname(Nickname::normalize($credentials['nickname_or_email'], check_already_used: false, which: Nickname::CHECK_LOCAL_USER, check_is_allowed: false)); + $user = LocalUser::getByNickname($credentials['nickname_or_email']); } if ($user === null) { throw new NoSuchActorException('No such local user.'); } $credentials['nickname'] = $user->getNickname(); - } catch (Exception) { + } catch (NotFoundException) { throw new CustomUserMessageAuthenticationException( _m('Invalid login credentials.'), );