@@ -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 }
@@ -343,30 +343,19 @@ public function check(array $credentials): Result
343343 /** @var Passwords $passwords */
344344 $ passwords = service ('passwords ' );
345345
346- // This is only for supportOldDangerousPassword.
347- $ needsRehash = false ;
348-
349346 // Now, try matching the passwords.
350347 if (! $ passwords ->verify ($ givenPassword , $ user ->password_hash )) {
351- if (
352- ! setting ('Auth.supportOldDangerousPassword ' )
353- || ! $ passwords ->verifyDanger ($ givenPassword , $ user ->password_hash ) // @phpstan-ignore-line
354- ) {
355- return new Result ([
356- 'success ' => false ,
357- 'reason ' => lang ('Auth.invalidPassword ' ),
358- ]);
359- }
360-
361- // Passed with old dangerous password.
362- $ needsRehash = true ;
348+ return new Result ([
349+ 'success ' => false ,
350+ 'reason ' => lang ('Auth.invalidPassword ' ),
351+ ]);
363352 }
364353
365354 // Check to see if the password needs to be rehashed.
366355 // This would be due to the hash algorithm or hash
367356 // cost changing since the last time that a user
368357 // logged in.
369- if ($ passwords ->needsRehash ($ user ->password_hash ) || $ needsRehash ) {
358+ if ($ passwords ->needsRehash ($ user ->password_hash )) {
370359 $ user ->password_hash = $ passwords ->hash ($ givenPassword );
371360 $ this ->provider ->save ($ user );
372361 }
@@ -661,10 +650,10 @@ public function startLogin(User $user): void
661650 if ($ userId !== null ) {
662651 throw new LogicException (
663652 'The user has User Info in Session, so already logged in or in pending login state. '
664- . ' If a logged in user logs in again with other account, the session data of the previous '
665- . ' user will be used as the new user. '
666- . ' Fix your code to prevent users from logging in without logging out or delete the session data. '
667- . ' 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
668657 );
669658 }
670659
@@ -749,18 +738,18 @@ public function login(User $user): void
749738 if ($ this ->getIdentitiesForAction ($ user ) !== []) {
750739 throw new LogicException (
751740 'The user has identities for action, so cannot complete login. '
752- . ' If you want to start to login with auth action, use startLogin() instead. '
753- . ' Or delete identities for action in database. '
754- . ' 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
755744 );
756745 }
757746 // Check auth_action in Session
758747 if ($ this ->getSessionKey ('auth_action ' )) {
759748 throw new LogicException (
760749 'The user has auth action in session, so cannot complete login. '
761- . ' If you want to start to login with auth action, use startLogin() instead. '
762- . ' Or delete `auth_action` and `auth_action_message` in session data. '
763- . ' 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
764753 );
765754 }
766755
0 commit comments