Skip to content

Commit

Permalink
fix login error rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jul 1, 2024
1 parent 3f4d9c6 commit a618e58
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 34 deletions.
2 changes: 1 addition & 1 deletion development/m991231_235959_insert_test_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function safeUp()
$passwords,
]);

for ($i = 0; $i < count($users); $i++) {
for ($i = 1; $i <= count($users); $i++) {
$this->update('{{user}}', ['current_password_id' => $i], 'id=' . $i);
}
}
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ services:
MYSQL_PASSWORD: "silauth"
SECURE_COOKIE: "false"
SHOW_SAML_ERRORS: "true"
RECAPTCHA_SITE_KEY: "0123456789abcdefghijklmnoABCDEFGHIJKLMNO"

ssp-idp3.local:
build: .
Expand Down Expand Up @@ -377,7 +376,7 @@ services:
EMAIL_SIGNATURE: "one red pill, please"
API_ACCESS_KEYS: "test-cli-abc123"
APP_ENV: "prod"
RP_ORIGINS: "https://ssp-idp1.local,https://ssp-idp3.local,https://ssp-idp3.local"
RP_ORIGINS: "https://ssp-idp1.local,https://ssp-idp2.local,https://ssp-idp3.local"
HIBP_CHECK_ON_LOGIN: "false"
MFA_TOTP_apiBaseUrl: dummy
MFA_TOTP_apiKey: 10345678-1234-1234-1234-123456789012
Expand Down
12 changes: 10 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
use Behat\Behat\Hook\Scope\AfterStepScope;
use Behat\Behat\Tester\Result\StepResult;
use Behat\Gherkin\Node\PyStringNode;
use Behat\MinkExtension\Context\MinkContext;
use Behat\Mink\Element\DocumentElement;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Mink;
use Behat\Mink\Session;
use Behat\Testwork\Tester\Result\TestResult;
use Behat\MinkExtension\Context\MinkContext;
use DMore\ChromeDriver\ChromeDriver;
use Webmozart\Assert\Assert;

Expand Down Expand Up @@ -117,6 +116,15 @@ public function iLogInAsAHubAdministrator()
$this->logInAs('admin', 'abc123');
}

/**
* @When I provide a username and an incorrect password
*/
public function iProvideAUsernameAndAnIncorrectPassword()
{
$this->username = "sildisco_idp2";
$this->password = "not_correct";
}

protected function logInAs(string $username, string $password)
{
$this->fillField('username', $username);
Expand Down
7 changes: 7 additions & 0 deletions features/material.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ Feature: Material theme
And I click on the "IDP 2" tile
Then I should see a "Login with your IDP 2 identity" page
And I should see our material theme

Scenario: Login error
When I go to the SP1 login page
And I click on the "IDP 2" tile
And I provide a username and an incorrect password
And I log in
Then I should see "There was a problem with that username or password"
24 changes: 24 additions & 0 deletions modules/material/locales/en/LC_MESSAGES/material.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ msgstr "Error"
msgid "{error:message}"
msgstr "An error occurred, please contact your help desk for further assistance."

msgid "{error:generic_try_later}"
msgstr "Hmm... something went wrong. Please try again later."

msgid "{error:username_required}"
msgstr "Please provide a username."

msgid "{error:password_required}"
msgstr "Please provide a password."

msgid "{error:invalid_login}"
msgstr "There was a problem with that username or password (or that account is disabled). Please try again or contact your organization's help desk."

msgid "{error:need_to_set_acct_password}"
msgstr "You need to set your password to finish setting up your account. Please use the forgot password link below."

msgid "{error:rate_limit_seconds}"
msgstr "There have been too many failed logins for this account. Please wait about %number% seconds, then try again."

msgid "{error:rate_limit_1_minute}"
msgstr "There have been too many failed logins for this account. Please wait a minute, then try again."

msgid "{error:rate_limit_minutes}"
msgstr "There have been too many failed logins for this account. Please wait about %number% minutes, then try again."

msgid "{expired:title}"
msgstr "Expired password"

Expand Down
24 changes: 24 additions & 0 deletions modules/material/locales/es/LC_MESSAGES/material.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ msgstr "Error"
msgid "{error:message}"
msgstr "Se ha producido un error, póngase en contacto con su asistencia técnica para obtener más ayuda."

msgid "{error:generic_try_later}"
msgstr "Algo salió mal. Por favor, inténtelo de nuevo más tarde."

msgid "{error:username_required}"
msgstr "Por favor proporcione un nombre de usuario."

msgid "{error:password_required}"
msgstr "Proporcione una contraseña."

msgid "{error:invalid_login}"
msgstr "Hubo un problema con ese nombre de usuario o contraseña (o esa cuenta está deshabilitada). Inténtelo de nuevo o comuníquese con el servicio de asistencia técnica de su organización."

msgid "{error:need_to_set_acct_password}"
msgstr "Debes configurar tu contraseña para terminar de configurar tu cuenta. Utilice el enlace de olvidé mi contraseña que aparece a continuación."

msgid "{error:rate_limit_seconds}"
msgstr "Ha habido demasiados inicios de sesión fallidos para esta cuenta. Espere unos %number% segundos y vuelva a intentarlo."

msgid "{error:rate_limit_1_minute}"
msgstr "Ha habido demasiados inicios de sesión fallidos para esta cuenta. Espere un minuto y vuelva a intentarlo."

msgid "{error:rate_limit_minutes}"
msgstr "Ha habido demasiados inicios de sesión fallidos para esta cuenta. Espere unos %number% minutos y vuelva a intentarlo."

msgid "{expired:title}"
msgstr "Contraseña caducada"

Expand Down
24 changes: 24 additions & 0 deletions modules/material/locales/fr/LC_MESSAGES/material.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ msgstr "Erreur"
msgid "{error:message}"
msgstr "Une erreur s'est produite, s'il vous plaît contacter votre service d'assistance pour plus d'assistance."

msgid "{error:generic_try_later}"
msgstr "Quelque chose s'est mal passé. Veuillez réessayer plus tard."

msgid "{error:username_required}"
msgstr "Veuillez fournir un nom d'utilisateur."

msgid "{error:password_required}"
msgstr "Veuillez fournir un mot de passe."

msgid "{error:invalid_login}"
msgstr "Il y a eu un problème avec ce nom d'utilisateur ou ce mot de passe (ou ce compte est désactivé). Veuillez réessayer ou contacter le service d'assistance de votre organisation."

msgid "{error:need_to_set_acct_password}"
msgstr "Vous devez définir votre mot de passe pour terminer la configuration de votre compte. Veuillez utiliser le lien mot de passe oublié ci-dessous."

msgid "{error:rate_limit_seconds}"
msgstr "Il y a eu trop d'échecs de connexion pour ce compte. Veuillez patienter environ %number% secondes, puis réessayez."

msgid "{error:rate_limit_1_minute}"
msgstr "Il y a eu trop d'échecs de connexion pour ce compte. Veuillez patienter une minute, puis réessayez."

msgid "{error:rate_limit_minutes}"
msgstr "Il y a eu trop d'échecs de connexion pour ce compte. Veuillez patienter environ %number% minutes, puis réessayez."

msgid "{expired:title}"
msgstr "Mot de passe expiré"

Expand Down
24 changes: 24 additions & 0 deletions modules/material/locales/ko/LC_MESSAGES/material.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ msgstr "오류"
msgid "{error:message}"
msgstr "오류가 발생했습니다. 도움을 받으려면 헬프 데스크에 문의하십시오."

msgid "{error:generic_try_later}"
msgstr "문제가 발생했습니다. 나중에 다시 시도 해주십시오."

msgid "{error:username_required}"
msgstr "사용자 이름을 입력하세요."

msgid "{error:password_required}"
msgstr "비밀번호를 입력하세요."

msgid "{error:invalid_login}"
msgstr "해당 사용자 이름이나 비밀번호에 문제가 있습니다(또는 해당 계정이 비활성화되었습니다). 다시 시도하거나 조직의 지원 센터에 문의하세요."

msgid "{error:need_to_set_acct_password}"
msgstr "계정 설정을 완료하려면 비밀번호를 설정해야 합니다. 아래 비밀번호 찾기 링크를 이용해 주세요."

msgid "{error:rate_limit_seconds}"
msgstr "이 계정에 대한 로그인 실패 횟수가 너무 많습니다. %number%초 정도 기다린 후 다시 시도하십시오."

msgid "{error:rate_limit_1_minute}"
msgstr "이 계정에 대한 로그인 실패 횟수가 너무 많습니다. 잠시 기다린 후 다시 시도해 주세요."

msgid "{error:rate_limit_minutes}"
msgstr "이 계정에 대한 로그인 실패 횟수가 너무 많습니다. %number%분 정도 기다린 후 다시 시도하십시오."

msgid "{expired:title}"
msgstr "만료 된 암호"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
</script>

{% if siteKey is defined and siteKey is not empty %}
{% if siteKey is not empty %}
<script src='https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoad&render=explicit' async defer></script>

<script>
Expand Down
23 changes: 0 additions & 23 deletions modules/silauth/locales/en/LC_MESSAGES/silauth.po

This file was deleted.

5 changes: 2 additions & 3 deletions modules/silauth/public/loginuserpass.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@
$t->data['helpCenterUrl'] = $state['templateData']['helpCenterUrl'] ?? '';
$t->data['announcement'] = AnnouncementUtils::getAnnouncement();
$t->data['idpName'] = $globalConfig->getString('idp_display_name');
$t->data['siteKey'] = $recaptchaSiteKey;
$t->data['passwordForgotUrl'] = $globalConfig->getOptionalString('passwordForgotUrl', '');

/* For simplicity's sake, don't bother telling this Request to trust any IP
* addresses. This is okay because we only track the failures of untrusted
* IP addresses, so there will be no failed logins of IP addresses we trust. */
$request = new Request();
if (Authenticator::isCaptchaRequired($username, $request->getUntrustedIpAddresses())) {
$t->data['recaptcha.siteKey'] = $recaptchaSiteKey;
$t->data['siteKey'] = $recaptchaSiteKey;
} else {
$t->data['recaptcha.siteKey'] = null;
$t->data['siteKey'] = null;
}

if (isset($state['SPMetadata'])) {
Expand Down
3 changes: 1 addition & 2 deletions modules/silauth/src/Auth/Source/auth/AuthError.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public function getCode(): string
public function getFullSspErrorTag(): string
{
return sprintf(
'{%s:%s}',
'silauth:error',
'{error:%s}',
$this->getCode()
);
}
Expand Down

0 comments on commit a618e58

Please sign in to comment.