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">
|
<input type="password" required id="loginPassword" maxlength="100">
|
||||||
</label>
|
</label>
|
||||||
<section id="loginErrorMessages"></section>
|
<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>
|
<a id="forgotPasswordButton" class="small button">Forgot Password?</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -42,7 +42,7 @@ export function renderLoginForm() {
|
||||||
<input type="checkbox" id="createNewAllowEmails">
|
<input type="checkbox" id="createNewAllowEmails">
|
||||||
</label>
|
</label>
|
||||||
<section id="createAccountErrorMessages"></section>
|
<section id="createAccountErrorMessages"></section>
|
||||||
<a id="createAccountSubmit" class="button">Create Account</a>
|
<button id="createAccountSubmit" class="button">Create Account</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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('loginSubmit').addEventListener('click', logIn);
|
||||||
document.getElementById('createAccountSubmit').addEventListener('click', createAccount);
|
document.getElementById('createAccountSubmit').addEventListener('click', createAccount);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue