Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit ba4c227

Browse files
Merge pull request #2 from silinternational/feature/forgot-password-link
Add "Forgot password?" link if a URL was provided
2 parents 23e5396 + ab56afe commit ba4c227

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

dictionaries/login.definition.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,11 @@
3434
"es": "Iniciar sesión",
3535
"fr": "Connexion",
3636
"ko": "로그인"
37+
},
38+
"forgot": {
39+
"en": "Forgot your password? Reset it now",
40+
"es": "¿Olvidaste tu contraseña? Restablecer ahora",
41+
"fr": "Mot de passe oublié? Réinitialisez-le maintenant",
42+
"ko": "비밀번호를 잊어 버렸습니까? 지금 다시 설정하십시오"
3743
}
3844
}

themes/material/core/loginuserpass.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<?php
33
$siteKey = $this->data['recaptcha.siteKey'] ?? null;
44
$username = $this->data['username'] ?? null;
5+
$forgotPasswordUrl = $this->data['forgotPasswordUrl'] ?? null;
56
$csrfToken = $this->data['csrfToken'] ?? null;
6-
7+
78
$errorCode = $this->data['errorcode'] ?? null;
89
$errorMessageKey = $this->data['errorparams'][1] ?? '{material:login:error_wronguserpass}';
910
$errorMessageTokens = $this->data['errorparams'][2] ?? [];
@@ -73,7 +74,7 @@ function onRecaptchaLoad() {
7374
<input type="password" name="password" class="mdl-textfield__input"
7475
<?= ! empty($username) ? 'autofocus' : '' ?> />
7576
</div>
76-
77+
7778
<?php
7879
if ($errorCode == 'WRONGUSERPASS') {
7980
?>
@@ -92,6 +93,19 @@ function onRecaptchaLoad() {
9293
<button class="mdl-button mdl-button--colored mdl-button--raised">
9394
<?= $this->t('{material:login:button_login}') ?>
9495
</button>
96+
97+
<?php
98+
if (! empty($forgotPasswordUrl)) {
99+
?>
100+
<p class="mdl-typography--caption margin">
101+
<a href="<?= htmlentities($forgotPasswordUrl) ?>"
102+
target="_blank">
103+
<?= $this->t('{material:login:forgot}') ?>
104+
</a>
105+
<p>
106+
<?php
107+
}
108+
?>
95109
</form>
96110
</main>
97111

0 commit comments

Comments
 (0)