Skip to content
Snippets Groups Projects
Commit fdee3395 authored by catch's avatar catch
Browse files

Issue #3306107 by b_sharpe, catch, carolpettirossi, quietone: Allow failed...

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

(cherry picked from commit b9161b4f)
parent b868899b
No related branches found
No related tags found
2 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #278376 passed with warnings
Pipeline: drupal

#278380

    ......@@ -284,7 +284,7 @@ public function validateFinal(array &$form, FormStateInterface $form_state) {
    // 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);
    }
    ......
    ......@@ -311,7 +311,7 @@ public function assertFailedLogin(User $account, ?string $flood_trigger = NULL):
    ->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 @@ public function assertFailedLogin(User $account, ?string $flood_trigger = NULL):
    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.');
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment