Skip to content

Commit 3e63a6c

Browse files
committed
Tweaks based on feedback
1 parent 0c8d7c0 commit 3e63a6c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

security/user_checkers.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ are not met, an exception should be thrown which extends the
2525
use App\Exception\AccountDeletedException;
2626
use App\Security\User as AppUser;
2727
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
28+
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
2829
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2930
use Symfony\Component\Security\Core\User\UserInterface;
3031
@@ -39,6 +40,11 @@ are not met, an exception should be thrown which extends the
3940
// user is deleted, show a generic Account Not Found message.
4041
if ($user->isDeleted()) {
4142
throw new AccountDeletedException('...');
43+
44+
// or to customize the message shown
45+
throw new CustomUserMessageAuthenticationException(
46+
'Your account was deleted. Sorry about that!'
47+
);
4248
}
4349
}
4450

security/user_provider.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ User providers are configured in ``config/packages/security.yaml`` under the
4949
memory:
5050
# custom options for that provider
5151
users:
52-
user: { password: userpass, roles: [ 'ROLE_USER' ] }
53-
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
52+
user: { password: '%env(USER_PASSWORD)%', roles: [ 'ROLE_USER' ] }
53+
admin: { password: '%env(ADMIN_PASSWORD)%', roles: [ 'ROLE_ADMIN' ] }
5454
5555
a_chain_provider:
5656
chain:

0 commit comments

Comments
 (0)