Skip to content

Commit f54d7bf

Browse files
omerimzalikenjis
authored andcommitted
supportOldDangerousPassword support removed && style fixes according to style guide
1 parent fef02d1 commit f54d7bf

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
@@ -102,8 +102,8 @@ private function checkSecurityConfig(): void
102102
if ($securityConfig->csrfProtection === 'cookie') {
103103
throw new SecurityException(
104104
'Config\Security::$csrfProtection is set to \'cookie\'.'
105-
. ' Same-site attackers may bypass the CSRF protection.'
106-
. ' Please set it to \'session\'.'
105+
. ' Same-site attackers may bypass the CSRF protection.'
106+
. ' Please set it to \'session\'.'
107107
);
108108
}
109109
}
@@ -137,7 +137,7 @@ public function attempt(array $credentials): Result
137137
$result = $this->check($credentials);
138138

139139
// Credentials mismatch.
140-
if (! $result->isOK()) {
140+
if (!$result->isOK()) {
141141
// Always record a login attempt, whether success or not.
142142
$this->recordLoginAttempt($credentials, false, $ipAddress, $userAgent);
143143

@@ -180,7 +180,7 @@ public function attempt(array $credentials): Result
180180

181181
$this->issueRememberMeToken();
182182

183-
if (! $this->hasAction()) {
183+
if (!$this->hasAction()) {
184184
$this->completeLogin($user);
185185
}
186186

@@ -291,10 +291,10 @@ private function recordLoginAttempt(
291291

292292
$field = array_pop($field);
293293

294-
if (! in_array($field, ['email', 'username'], true)) {
294+
if (!in_array($field, ['email', 'username'], true)) {
295295
$idType = $field;
296296
} else {
297-
$idType = (! isset($credentials['email']) && isset($credentials['username']))
297+
$idType = (!isset($credentials['email']) && isset($credentials['username']))
298298
? self::ID_TYPE_USERNAME
299299
: self::ID_TYPE_EMAIL_PASSWORD;
300300
}
@@ -344,12 +344,11 @@ public function check(array $credentials): Result
344344
$passwords = service('passwords');
345345

346346
// Now, try matching the passwords.
347-
if (! $passwords->verify($givenPassword, $user->password_hash)) {
348-
return new Result([
349-
'success' => false,
350-
'reason' => lang('Auth.invalidPassword'),
351-
]);
352-
347+
if (!$passwords->verify($givenPassword, $user->password_hash)) {
348+
return new Result([
349+
'success' => false,
350+
'reason' => lang('Auth.invalidPassword'),
351+
]);
353352
}
354353

355354
// Check to see if the password needs to be rehashed.
@@ -651,10 +650,10 @@ public function startLogin(User $user): void
651650
if ($userId !== null) {
652651
throw new LogicException(
653652
'The user has User Info in Session, so already logged in or in pending login state.'
654-
. ' If a logged in user logs in again with other account, the session data of the previous'
655-
. ' user will be used as the new user.'
656-
. ' Fix your code to prevent users from logging in without logging out or delete the session data.'
657-
. ' user_id: ' . $userId
653+
. ' If a logged in user logs in again with other account, the session data of the previous'
654+
. ' user will be used as the new user.'
655+
. ' Fix your code to prevent users from logging in without logging out or delete the session data.'
656+
. ' user_id: ' . $userId
658657
);
659658
}
660659

@@ -739,18 +738,18 @@ public function login(User $user): void
739738
if ($this->getIdentitiesForAction($user) !== []) {
740739
throw new LogicException(
741740
'The user has identities for action, so cannot complete login.'
742-
. ' If you want to start to login with auth action, use startLogin() instead.'
743-
. ' Or delete identities for action in database.'
744-
. ' user_id: ' . $user->id
741+
. ' If you want to start to login with auth action, use startLogin() instead.'
742+
. ' Or delete identities for action in database.'
743+
. ' user_id: ' . $user->id
745744
);
746745
}
747746
// Check auth_action in Session
748747
if ($this->getSessionKey('auth_action')) {
749748
throw new LogicException(
750749
'The user has auth action in session, so cannot complete login.'
751-
. ' If you want to start to login with auth action, use startLogin() instead.'
752-
. ' Or delete `auth_action` and `auth_action_message` in session data.'
753-
. ' user_id: ' . $user->id
750+
. ' If you want to start to login with auth action, use startLogin() instead.'
751+
. ' Or delete `auth_action` and `auth_action_message` in session data.'
752+
. ' user_id: ' . $user->id
754753
);
755754
}
756755

@@ -893,7 +892,7 @@ public function getPendingUser(): ?User
893892
*/
894893
public function recordActiveDate(): void
895894
{
896-
if (! $this->user instanceof User) {
895+
if (!$this->user instanceof User) {
897896
throw new InvalidArgumentException(
898897
__METHOD__ . '() requires logged in user before calling.'
899898
);

0 commit comments

Comments
 (0)