Enable login when pressing enter on fields
This commit is contained in:
parent
b69af6c4f6
commit
f0be285b3e
|
@ -18,7 +18,7 @@ export function renderLoginForm() {
|
|||
<input type="password" required id="loginPassword" maxlength="100">
|
||||
</label>
|
||||
<section id="loginErrorMessages"></section>
|
||||
<a id="loginSubmit" class="button">Log In</a><br>
|
||||
<button id="loginSubmit" class="button">Log In</button><br>
|
||||
<a id="forgotPasswordButton" class="small button">Forgot Password?</a>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -42,7 +42,7 @@ export function renderLoginForm() {
|
|||
<input type="checkbox" id="createNewAllowEmails">
|
||||
</label>
|
||||
<section id="createAccountErrorMessages"></section>
|
||||
<a id="createAccountSubmit" class="button">Create Account</a>
|
||||
<button id="createAccountSubmit" class="button">Create Account</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -10,6 +10,30 @@ export function setupLoginModal(modal) {
|
|||
});
|
||||
});
|
||||
|
||||
[
|
||||
document.getElementById('loginEmail'),
|
||||
document.getElementById('loginPassword'),
|
||||
].forEach(field => {
|
||||
field.addEventListener('keydown', event => {
|
||||
if (['Enter', 'Return'].includes(event.key)) {
|
||||
logIn();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
[
|
||||
document.getElementById('createNewEmail'),
|
||||
document.getElementById('createNewPassword'),
|
||||
document.getElementById('createNewConfirm'),
|
||||
document.getElementById('createNewPublicName'),
|
||||
].forEach(field => {
|
||||
field.addEventListener('keydown', event => {
|
||||
if (['Enter', 'Return'].includes(event.key)) {
|
||||
createAccount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('loginSubmit').addEventListener('click', logIn);
|
||||
document.getElementById('createAccountSubmit').addEventListener('click', createAccount);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue