Skip to content

Commit 3d67202

Browse files
committed
tweaks thanks to the guys
1 parent 1eb5f23 commit 3d67202

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cookbook/security/api_key_authentication.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ value and then a User object is created::
7070
$username = $userProvider->getUsernameForApiKey($apiKey);
7171

7272
if (!$username) {
73-
// this message will be returned to the client
73+
// CAUTION: this message will be returned to the client
74+
// (so don't put any un-trusted messages / error strings here)
7475
throw new CustomUserMessageAuthenticationException(
7576
sprintf('API Key "%s" does not exist.', $apiKey)
7677
);

cookbook/security/custom_password_authenticator.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ the user::
4747
try {
4848
$user = $userProvider->loadUserByUsername($token->getUsername());
4949
} catch (UsernameNotFoundException $e) {
50-
// error will be shown to the client
50+
// CAUTION: this message will be returned to the client
51+
// (so don't put any un-trusted messages / error strings here)
5152
throw new CustomUserMessageAuthenticationException('Invalid username or password');
5253
}
5354

@@ -56,7 +57,8 @@ the user::
5657
if ($passwordValid) {
5758
$currentHour = date('G');
5859
if ($currentHour < 14 || $currentHour > 16) {
59-
// error will be shown to the client
60+
// CAUTION: this message will be returned to the client
61+
// (so don't put any un-trusted messages / error strings here)
6062
throw new CustomUserMessageAuthenticationException(
6163
'You can only log in between 2 and 4!',
6264
100
@@ -71,7 +73,8 @@ the user::
7173
);
7274
}
7375

74-
// error will be shown to the client
76+
// CAUTION: this message will be returned to the client
77+
// (so don't put any un-trusted messages / error strings here)
7578
throw new CustomUserMessageAuthenticationException('Invalid username or password');
7679
}
7780

0 commit comments

Comments
 (0)