$this->userFloodControl->
register('user.failed_login_user',
$flood_config->
get('user_window'
),
$flood_control_user_identifier);
} if ($flood_control_triggered =
$form_state->
get('flood_control_triggered'
)) { if ($flood_control_triggered == 'user'
) { $message =
$this->
formatPlural($flood_config->
get('user_limit'
), 'There has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', 'There have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.',
[':url' => Url::
fromRoute('user.pass'
)->
toString()]);
} else { // 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->
setStatusCode(403
);
$form_state->
setResponse($response);
} else { // Use $form_state->getUserInput() in the error message to guarantee
// that we send exactly what the user typed in. The value from
// $form_state->getValue() may have been modified by validation
// handlers that ran earlier than this one.
$user_input =
$form_state->
getUserInput();
$query =
isset($user_input['name'
]) ?
['name' =>
$user_input['name'
]] :
[];
$form_state->
setErrorByName('name',
$this->
t('Unrecognized username or password. <a href=":password">Forgot your password?</a>',
[':password' => Url::
fromRoute('user.pass',
[],
['query' =>
$query])->
toString()]));