Skip to content

Commit 6cdc44a

Browse files
committed
supportOldDangerousPassword support removed && style fixes according to style guide
1 parent 808b098 commit 6cdc44a

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

src/Authentication/Authenticators/Session.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ private function checkSecurityConfig(): void
9595
if ($securityConfig->csrfProtection === 'cookie') {
9696
throw new SecurityException(
9797
'Config\Security::$csrfProtection is set to \'cookie\'.'
98-
. ' Same-site attackers may bypass the CSRF protection.'
99-
. ' Please set it to \'session\'.'
98+
. ' Same-site attackers may bypass the CSRF protection.'
99+
. ' Please set it to \'session\'.'
100100
);
101101
}
102102
}
@@ -130,7 +130,7 @@ public function attempt(array $credentials): Result
130130
$result = $this->check($credentials);
131131

132132
// Credentials mismatch.
133-
if (! $result->isOK()) {
133+
if (!$result->isOK()) {
134134
// Always record a login attempt, whether success or not.
135135
$this->recordLoginAttempt($credentials, false, $ipAddress, $userAgent);
136136

@@ -173,7 +173,7 @@ public function attempt(array $credentials): Result
173173

174174
$this->issueRememberMeToken();
175175

176-
if (! $this->hasAction()) {
176+
if (!$this->hasAction()) {
177177
$this->completeLogin($user);
178178
}
179179

@@ -284,10 +284,10 @@ private function recordLoginAttempt(
284284

285285
$field = array_pop($field);
286286

287-
if (! in_array($field, ['email', 'username'], true)) {
287+
if (!in_array($field, ['email', 'username'], true)) {
288288
$idType = $field;
289289
} else {
290-
$idType = (! isset($credentials['email']) && isset($credentials['username']))
290+
$idType = (!isset($credentials['email']) && isset($credentials['username']))
291291
? self::ID_TYPE_USERNAME
292292
: self::ID_TYPE_EMAIL_PASSWORD;
293293
}
@@ -337,12 +337,11 @@ public function check(array $credentials): Result
337337
$passwords = service('passwords');
338338

339339
// Now, try matching the passwords.
340-
if (! $passwords->verify($givenPassword, $user->password_hash)) {
341-
return new Result([
342-
'success' => false,
343-
'reason' => lang('Auth.invalidPassword'),
344-
]);
345-
340+
if (!$passwords->verify($givenPassword, $user->password_hash)) {
341+
return new Result([
342+
'success' => false,
343+
'reason' => lang('Auth.invalidPassword'),
344+
]);
346345
}
347346

348347
// Check to see if the password needs to be rehashed.
@@ -644,10 +643,10 @@ public function startLogin(User $user): void
644643
if ($userId !== null) {
645644
throw new LogicException(
646645
'The user has User Info in Session, so already logged in or in pending login state.'
647-
. ' If a logged in user logs in again with other account, the session data of the previous'
648-
. ' user will be used as the new user.'
649-
. ' Fix your code to prevent users from logging in without logging out or delete the session data.'
650-
. ' user_id: ' . $userId
646+
. ' If a logged in user logs in again with other account, the session data of the previous'
647+
. ' user will be used as the new user.'
648+
. ' Fix your code to prevent users from logging in without logging out or delete the session data.'
649+
. ' user_id: ' . $userId
651650
);
652651
}
653652

@@ -732,18 +731,18 @@ public function login(User $user): void
732731
if ($this->getIdentitiesForAction($user) !== []) {
733732
throw new LogicException(
734733
'The user has identities for action, so cannot complete login.'
735-
. ' If you want to start to login with auth action, use startLogin() instead.'
736-
. ' Or delete identities for action in database.'
737-
. ' user_id: ' . $user->id
734+
. ' If you want to start to login with auth action, use startLogin() instead.'
735+
. ' Or delete identities for action in database.'
736+
. ' user_id: ' . $user->id
738737
);
739738
}
740739
// Check auth_action in Session
741740
if ($this->getSessionKey('auth_action')) {
742741
throw new LogicException(
743742
'The user has auth action in session, so cannot complete login.'
744-
. ' If you want to start to login with auth action, use startLogin() instead.'
745-
. ' Or delete `auth_action` and `auth_action_message` in session data.'
746-
. ' user_id: ' . $user->id
743+
. ' If you want to start to login with auth action, use startLogin() instead.'
744+
. ' Or delete `auth_action` and `auth_action_message` in session data.'
745+
. ' user_id: ' . $user->id
747746
);
748747
}
749748

@@ -886,7 +885,7 @@ public function getPendingUser(): ?User
886885
*/
887886
public function recordActiveDate(): void
888887
{
889-
if (! $this->user instanceof User) {
888+
if (!$this->user instanceof User) {
890889
throw new InvalidArgumentException(
891890
__METHOD__ . '() requires logged in user before calling.'
892891
);

0 commit comments

Comments
 (0)