authentication: add focus + renamed function

This commit is contained in:
AdrienLSH 2024-02-13 14:58:07 +01:00
parent 157383748f
commit 0735c028f8

View File

@ -29,7 +29,7 @@ export default class extends AbstractNonAuthenticatedView
let new_mode = location.pathname.slice(1);
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'),
password_input = document.getElementById('password-input');
@ -37,9 +37,10 @@ export default class extends AbstractNonAuthenticatedView
[username_input, password_input].forEach(input => {
input.addEventListener('keydown', async ev => {
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}
*/
async authencation()
async authentication()
{
let username = document.getElementById("username-input").value,
password = document.getElementById("password-input").value;
@ -171,4 +172,4 @@ export default class extends AbstractNonAuthenticatedView
</div>
`;
}
}
}