authentication: add focus + renamed function

This commit is contained in:
AdrienLSH 2024-02-13 14:58:07 +01:00
parent 604494cee9
commit bc7504824a

View File

@ -29,7 +29,7 @@ export default class extends AbstractNonAuthenticatedView
let new_mode = location.pathname.slice(1); let new_mode = location.pathname.slice(1);
this.update_mode(new_mode); this.update_mode(new_mode);
document.getElementById("button").onclick = this.authencation.bind(this); document.getElementById("button").onclick = this.authentication.bind(this);
let username_input = document.getElementById('username-input'), let username_input = document.getElementById('username-input'),
password_input = document.getElementById('password-input'); password_input = document.getElementById('password-input');
@ -37,9 +37,10 @@ export default class extends AbstractNonAuthenticatedView
[username_input, password_input].forEach(input => { [username_input, password_input].forEach(input => {
input.addEventListener('keydown', async ev => { input.addEventListener('keydown', async ev => {
if (ev.key === 'Enter') if (ev.key === 'Enter')
await this.authencation.bind(this)() await this.authentication.bind(this)()
}); });
}); });
username_input.focus();
} }
/** /**
@ -114,7 +115,7 @@ export default class extends AbstractNonAuthenticatedView
/** /**
* @returns {Promise} * @returns {Promise}
*/ */
async authencation() async authentication()
{ {
let username = document.getElementById("username-input").value, let username = document.getElementById("username-input").value,
password = document.getElementById("password-input").value; password = document.getElementById("password-input").value;
@ -171,4 +172,4 @@ export default class extends AbstractNonAuthenticatedView
</div> </div>
`; `;
} }
} }