@@ -232,7 +232,7 @@ private function setPasswordResetInitialState(?string $username): void {
232232 $ this ->canResetPassword ($ passwordLink , $ user )
233233 );
234234 }
235-
235+
236236 /**
237237 * Sets the initial state of whether or not a user is allowed to login with their email
238238 * initial state is passed in the array of 1 for email allowed and 0 for not allowed
@@ -326,7 +326,8 @@ public function tryLogin(Chain $loginChain,
326326 $ user ,
327327 $ user ,
328328 $ redirect_url ,
329- self ::LOGIN_MSG_CSRFCHECKFAILED
329+ self ::LOGIN_MSG_CSRFCHECKFAILED ,
330+ false ,
330331 );
331332 }
332333
@@ -376,7 +377,12 @@ public function tryLogin(Chain $loginChain,
376377 * @return RedirectResponse
377378 */
378379 private function createLoginFailedResponse (
379- $ user , $ originalUser , $ redirect_url , string $ loginMessage ) {
380+ $ user ,
381+ $ originalUser ,
382+ $ redirect_url ,
383+ string $ loginMessage ,
384+ bool $ throttle = true ,
385+ ) {
380386 // Read current user and append if possible we need to
381387 // return the unmodified user otherwise we will leak the login name
382388 $ args = $ user !== null ? ['user ' => $ originalUser , 'direct ' => 1 ] : [];
@@ -386,7 +392,9 @@ private function createLoginFailedResponse(
386392 $ response = new RedirectResponse (
387393 $ this ->urlGenerator ->linkToRoute ('core.login.showLoginForm ' , $ args )
388394 );
389- $ response ->throttle (['user ' => substr ($ user , 0 , 64 )]);
395+ if ($ throttle ) {
396+ $ response ->throttle (['user ' => substr ($ user , 0 , 64 )]);
397+ }
390398 $ this ->session ->set ('loginMessages ' , [
391399 [$ loginMessage ], []
392400 ]);
0 commit comments