@@ -16,14 +16,15 @@ User checkers are classes that must implement the
16
16
defines two methods called ``checkPreAuth() `` and ``checkPostAuth() `` to
17
17
perform checks before and after user authentication. If one or more conditions
18
18
are not met, an exception should be thrown which extends the
19
+ :class: `Symfony\\ Component\\ Security\\ Core\\ Exception\\ CustomUserMessageAccountStatusException `,
19
20
:class: `Symfony\\ Component\\ Security\\ Core\\ Exception\\ AccountStatusException `
20
21
or :class: `Symfony\\ Component\\ Security\\ Core\\ Exception\\ AuthenticationException `::
21
22
22
23
namespace App\Security;
23
24
24
- use App\Exception\AccountDeletedException;
25
25
use App\Security\User as AppUser;
26
26
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
27
+ use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
27
28
use Symfony\Component\Security\Core\User\UserCheckerInterface;
28
29
use Symfony\Component\Security\Core\User\UserInterface;
29
30
@@ -35,9 +36,8 @@ or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExceptio
35
36
return;
36
37
}
37
38
38
- // user is deleted, show a generic Account Not Found message.
39
39
if ($user->isDeleted()) {
40
- throw new AccountDeletedException( );
40
+ throw new CustomUserMessageAccountStatusException('The user account was not found.' );
41
41
}
42
42
}
43
43
@@ -54,6 +54,10 @@ or :class:`Symfony\\Component\\Security\\Core\\Exception\\AuthenticationExceptio
54
54
}
55
55
}
56
56
57
+ .. versionadded :: 5.1
58
+
59
+ The ``CustomUserMessageAccountStatusException `` class was introduced in Symfony 5.1.
60
+
57
61
Enabling the Custom User Checker
58
62
--------------------------------
59
63
0 commit comments