Skip to content

Commit 2800959

Browse files
authored
Merge pull request #401 from sil-org/autofill-username
pass the username to the forgot password page on the profile manager
2 parents c1accde + 56879fa commit 2800959

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

modules/material/themes/material/silauth/loginuserpass.twig

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
event.preventDefault();
1111
}
1212
13+
function forgotPassword() {
14+
let url = '{{ password_forgot_url|e('js') }}';
15+
const username = document.getElementById('username').value;
16+
if (username) {
17+
const separator = url.includes('?') ? '&' : '?';
18+
url += separator + 'username=' + encodeURIComponent(username);
19+
}
20+
window.open(url, '_blank');
21+
}
22+
1323
//Remove invalid input state on page load
1424
window.addEventListener('load', () => {
1525
const clean = () => {
@@ -128,14 +138,13 @@
128138

129139
<div class="mdl-card__actions" layout-children="row">
130140
{% if password_forgot_url is not empty %}
131-
<a
132-
href="{{ password_forgot_url|e }}"
133-
target="_blank"
134-
rel="noopener"
141+
<button
142+
type="button"
143+
onclick="forgotPassword()"
135144
class="mdl-button mdl-button--colored mdl-typography--caption"
136145
>
137146
{{ '{login:forgot}'|trans }}
138-
</a>
147+
</button>
139148
{% endif %}
140149

141150
<span flex></span>

0 commit comments

Comments
 (0)