[Security] Fix exception constructors called in UserChecker
This commit is contained in:
parent
0038fbb8b6
commit
d7129b9a7e
@ -33,7 +33,9 @@ class UserChecker implements UserCheckerInterface
|
||||
}
|
||||
|
||||
if (!$user->isCredentialsNonExpired()) {
|
||||
throw new CredentialsExpiredException('User credentials have expired.', $user);
|
||||
$ex = new CredentialsExpiredException('User credentials have expired.');
|
||||
$ex->setExtraInformation($user);
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,15 +49,21 @@ class UserChecker implements UserCheckerInterface
|
||||
}
|
||||
|
||||
if (!$user->isAccountNonLocked()) {
|
||||
throw new LockedException('User account is locked.', $user);
|
||||
$ex = new LockedException('User account is locked.');
|
||||
$ex->setExtraInformation($user);
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
if (!$user->isEnabled()) {
|
||||
throw new DisabledException('User account is disabled.', $user);
|
||||
throw new DisabledException('User account is disabled.');
|
||||
$ex->setExtraInformation($user);
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
if (!$user->isAccountNonExpired()) {
|
||||
throw new AccountExpiredException('User account has expired.', $user);
|
||||
$ex = new AccountExpiredException('User account has expired.');
|
||||
$ex->setExtraInformation($user);
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user