Issue #3306107 by b_sharpe, catch, carolpettirossi, quietone: Allow failed logins in maintenance mode to be themed differently to other maintenance pages

merge-requests/9453/head
catch 2024-09-09 17:20:44 +01:00
parent bf4ae81164
commit b9161b4f06
2 changed files with 3 additions and 3 deletions

View File

@ -270,7 +270,7 @@ class UserLoginForm extends FormBase {
// We did not find a uid, so the limit is IP-based.
$message = $this->t('Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', [':url' => Url::fromRoute('user.pass')->toString()]);
}
$response = $this->bareHtmlPageRenderer->renderBarePage(['#markup' => $message], $this->t('Login failed'), 'maintenance_page');
$response = $this->bareHtmlPageRenderer->renderBarePage(['#markup' => $message], $this->t('Login failed'), 'maintenance_page__flood');
$response->setStatusCode(403);
$form_state->setResponse($response);
}

View File

@ -311,7 +311,7 @@ class UserLoginTest extends BrowserTestBase {
->fetchField();
if ($flood_trigger == 'user') {
$this->assertSession()->pageTextMatches("/There (has|have) been more than \w+ failed login attempt.* for this account. It is temporarily blocked. Try again later or request a new password./");
$this->assertSession()->elementExists('css', 'body.maintenance-page');
$this->assertSession()->elementExists('css', 'body.maintenance-page--flood');
$this->assertSession()->linkExists("request a new password");
$this->assertSession()->linkByHrefExists(Url::fromRoute('user.pass')->toString());
$this->assertEquals('Flood control blocked login attempt for uid %uid from %ip', $last_log, 'A watchdog message was logged for the login attempt blocked by flood control per user.');
@ -319,7 +319,7 @@ class UserLoginTest extends BrowserTestBase {
else {
// No uid, so the limit is IP-based.
$this->assertSession()->pageTextContains("Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or request a new password.");
$this->assertSession()->elementExists('css', 'body.maintenance-page');
$this->assertSession()->elementExists('css', 'body.maintenance-page--flood');
$this->assertSession()->linkExists("request a new password");
$this->assertSession()->linkByHrefExists(Url::fromRoute('user.pass')->toString());
$this->assertEquals('Flood control blocked login attempt from %ip', $last_log, 'A watchdog message was logged for the login attempt blocked by flood control per IP.');