|
|
@ -21,13 +21,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
if(username.value.length < 3) {
|
|
|
|
if(username.value.length < 3) {
|
|
|
|
username_notify.innerHTML = 'Username too short';
|
|
|
|
username_notify.innerHTML = 'Username too short';
|
|
|
|
username_notify.className = 'label label-important';
|
|
|
|
username_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else if(username.value.length > 13) {
|
|
|
|
} else if(username.value.length > 13) {
|
|
|
|
username_notify.innerHTML = 'Username too long';
|
|
|
|
username_notify.innerHTML = 'Username too long';
|
|
|
|
username_notify.className = 'label label-important';
|
|
|
|
username_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else if(!usernamevalid) {
|
|
|
|
} else if(!usernamevalid) {
|
|
|
|
username_notify.innerHTML = 'Invalid username';
|
|
|
|
username_notify.innerHTML = 'Invalid username';
|
|
|
|
username_notify.className = 'label label-important';
|
|
|
|
username_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
socket.emit('user.exists', {username: username.value});
|
|
|
|
socket.emit('user.exists', {username: username.value});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -38,7 +38,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
if(!emailvalid) {
|
|
|
|
if(!emailvalid) {
|
|
|
|
email_notify.innerHTML = 'Invalid email address';
|
|
|
|
email_notify.innerHTML = 'Invalid email address';
|
|
|
|
email_notify.className = 'label label-important';
|
|
|
|
email_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
socket.emit('user.email.exists', { email: emailEl.value });
|
|
|
|
socket.emit('user.email.exists', { email: emailEl.value });
|
|
|
@ -48,31 +48,35 @@
|
|
|
|
passwordvalid = utils.isPasswordValid(password.value);
|
|
|
|
passwordvalid = utils.isPasswordValid(password.value);
|
|
|
|
if (password.value.length < 6) {
|
|
|
|
if (password.value.length < 6) {
|
|
|
|
password_notify.innerHTML = 'Password too short';
|
|
|
|
password_notify.innerHTML = 'Password too short';
|
|
|
|
password_notify.className = 'label label-important';
|
|
|
|
password_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else if(!passwordvalid) {
|
|
|
|
} else if(!passwordvalid) {
|
|
|
|
password_notify.innerHTML = 'Invalid password';
|
|
|
|
password_notify.innerHTML = 'Invalid password';
|
|
|
|
password_notify.className = 'label label-important';
|
|
|
|
password_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
password_notify.innerHTML = 'OK!';
|
|
|
|
password_notify.innerHTML = '<i class="icon icon-ok"></i>';
|
|
|
|
password_notify.className = 'label label-success';
|
|
|
|
password_notify.parentNode.className = 'input-group-addon btn-success label-success';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(password.value !== password_confirm.value) {
|
|
|
|
if(password.value !== password_confirm.value && password_confirm.value.length > 0) {
|
|
|
|
password_confirm_notify.innerHTML = 'Passwords must match!';
|
|
|
|
password_confirm_notify.innerHTML = 'Passwords must match!';
|
|
|
|
password_confirm_notify.className = 'label label-important';
|
|
|
|
password_confirm_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
passwordsmatch = false;
|
|
|
|
passwordsmatch = false;
|
|
|
|
|
|
|
|
} else if (password.value === password_confirm.value && password_confirm.value.length > 0) {
|
|
|
|
|
|
|
|
password_confirm_notify.innerHTML = '<i class="icon icon-ok"></i>';
|
|
|
|
|
|
|
|
password_confirm_notify.parentNode.className = 'input-group-addon btn-success label-success';
|
|
|
|
|
|
|
|
passwordsmatch = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$(password_confirm).on('keyup', function() {
|
|
|
|
$(password_confirm).on('keyup', function() {
|
|
|
|
if(password.value !== password_confirm.value) {
|
|
|
|
if(password.value !== password_confirm.value) {
|
|
|
|
password_confirm_notify.innerHTML = 'Passwords must match!';
|
|
|
|
password_confirm_notify.innerHTML = 'Passwords must match!';
|
|
|
|
password_confirm_notify.className = 'label label-important';
|
|
|
|
password_confirm_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
passwordsmatch = false;
|
|
|
|
passwordsmatch = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
password_confirm_notify.innerHTML = 'OK!';
|
|
|
|
password_confirm_notify.innerHTML = '<i class="icon icon-ok"></i>';
|
|
|
|
password_confirm_notify.className = 'label label-success';
|
|
|
|
password_confirm_notify.parentNode.className = 'input-group-addon btn-success label-success';
|
|
|
|
passwordsmatch = true;
|
|
|
|
passwordsmatch = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -83,10 +87,10 @@
|
|
|
|
userexists = data.exists;
|
|
|
|
userexists = data.exists;
|
|
|
|
if (data.exists === true) {
|
|
|
|
if (data.exists === true) {
|
|
|
|
username_notify.innerHTML = 'Username exists';
|
|
|
|
username_notify.innerHTML = 'Username exists';
|
|
|
|
username_notify.className = 'label label-important';
|
|
|
|
username_notify.parentNode.className = 'input-group-addon btn-warning label-warning';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
username_notify.innerHTML = 'OK!';
|
|
|
|
username_notify.innerHTML = '<i class="icon icon-ok"></i>';
|
|
|
|
username_notify.className = 'label label-success';
|
|
|
|
username_notify.parentNode.className = 'input-group-addon btn-success label-success';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -95,11 +99,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (data.exists === true) {
|
|
|
|
if (data.exists === true) {
|
|
|
|
email_notify.innerHTML = 'Email Address exists';
|
|
|
|
email_notify.innerHTML = 'Email Address exists';
|
|
|
|
email_notify.className = 'label label-important';
|
|
|
|
email_notify.className = 'label label-warning';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
email_notify.innerHTML = 'OK!';
|
|
|
|
email_notify.innerHTML = '<i class="icon icon-ok"></i>';
|
|
|
|
email_notify.className = 'label label-success';
|
|
|
|
email_notify.parentNode.className = 'input-group-addon btn-success label-success';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -121,7 +125,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (username.value.length < 2 || !usernamevalid) {
|
|
|
|
if (username.value.length < 2 || !usernamevalid) {
|
|
|
|
username_notify.innerHTML = 'Invalid username';
|
|
|
|
username_notify.innerHTML = 'Invalid username';
|
|
|
|
username_notify.className = 'label label-important';
|
|
|
|
username_notify.className = 'label label-warning';
|
|
|
|
validated = false;
|
|
|
|
validated = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|