File tree Expand file tree Collapse file tree
src/Authentication/Authenticators
tests/Authentication/Authenticators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,14 +78,15 @@ public function attempt(array $credentials): Result
7878 return $ result ;
7979 }
8080
81- $ user = $ result ->extraInfo ();
81+ $ user = $ result ->extraInfo ();
82+ $ token = $ user ->getHmacToken ($ this ->getHmacKeyFromToken ());
8283
8384 if ($ user ->isBanned ()) {
8485 if ($ config ->recordLoginAttempt >= Auth::RECORD_LOGIN_ATTEMPT_FAILURE ) {
8586 // Record a banned login attempt.
8687 $ this ->loginModel ->recordLoginAttempt (
8788 self ::ID_TYPE_HMAC_TOKEN ,
88- $ credentials [ ' token ' ] ?? '' ,
89+ $ token-> name ?? '' ,
8990 false ,
9091 $ ipAddress ,
9192 $ userAgent ,
@@ -101,17 +102,15 @@ public function attempt(array $credentials): Result
101102 ]);
102103 }
103104
104- $ user = $ user ->setHmacToken (
105- $ user ->getHmacToken ($ this ->getHmacKeyFromToken ())
106- );
105+ $ user = $ user ->setHmacToken ($ token );
107106
108107 $ this ->login ($ user );
109108
110109 if ($ config ->recordLoginAttempt === Auth::RECORD_LOGIN_ATTEMPT_ALL ) {
111110 // Record a successful login attempt.
112111 $ this ->loginModel ->recordLoginAttempt (
113112 self ::ID_TYPE_HMAC_TOKEN ,
114- $ credentials [ ' token ' ] ?? '' ,
113+ $ token-> name ?? '' ,
115114 true ,
116115 $ ipAddress ,
117116 $ userAgent ,
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ public function testAttemptSuccess(): void
273273 // A login attempt should have been recorded
274274 $ this ->seeInDatabase ($ this ->tables ['token_logins ' ], [
275275 'id_type ' => HmacSha256::ID_TYPE_HMAC_TOKEN ,
276- 'identifier ' => $ rawToken ,
276+ 'identifier ' => ' foo ' ,
277277 'success ' => 1 ,
278278 ]);
279279
@@ -310,7 +310,7 @@ public function testAttemptBanned(): void
310310 // A login attempt should have been recorded
311311 $ this ->seeInDatabase ($ this ->tables ['token_logins ' ], [
312312 'id_type ' => HmacSha256::ID_TYPE_HMAC_TOKEN ,
313- 'identifier ' => $ rawToken ,
313+ 'identifier ' => ' foo ' ,
314314 'success ' => 0 ,
315315 ]);
316316 }
You can’t perform that action at this time.
0 commit comments