frontend: email optional

This commit is contained in:
realaravinth
2021-04-12 11:21:02 +05:30
parent d32350e2b6
commit 420ff75817
3 changed files with 11 additions and 10 deletions

View File

@@ -17,14 +17,13 @@
</label>
<label class="form__in-group" for="username"
>Email
>Email(optional)
<input
class="form__in-field"
id="email"
type="email"
name="email"
id="email"
required
/>
</label>

View File

@@ -20,17 +20,19 @@ const registerUser = async e => {
return alert("passwords don't match, check again!");
}
let email = document.getElementById('email').value;
isBlankString(e, email, 'email');
let exists = await userExists();
if (exists) {
return;
}
exists = await checkEmailExists();
if (exists) {
return;
let email = document.getElementById('email').value;
if (!email.replace(/\s/g, '').length) {
email = null;
} else {
exists = await checkEmailExists();
if (exists) {
return;
}
}
let payload = {
@@ -54,4 +56,4 @@ export const index = () => {
let username = document.getElementById('username');
username.addEventListener('input', userExists, false);
}
};