feat(reset): added a name validator
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
function validate_form(minlength) {
|
||||
var user = validate_username();
|
||||
var pass = validate_password(minlength);
|
||||
|
||||
return validate_confirm() && pass;
|
||||
return validate_confirm() && pass && user;
|
||||
}
|
||||
|
||||
function validate_confirm() {
|
||||
@@ -20,6 +21,22 @@ function validate_confirm() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function validate_username() {
|
||||
var username = document.getElementById("username");
|
||||
var forbidden = /[*?!'\^+%\&/()=}{\$#;,\\"]+/;
|
||||
|
||||
if (username.value.length > 64 || forbidden.test(username.value) == true)
|
||||
{
|
||||
document.getElementById("username-msg").classList.add("errormsg");
|
||||
username.classList.add("errorinput");
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById("username-msg").classList.remove("errormsg");
|
||||
username.classList.remove("errorinput");
|
||||
return true;
|
||||
}
|
||||
|
||||
function validate_password(minlength) {
|
||||
// Did the checks pass ?
|
||||
var status = true;
|
||||
@@ -56,7 +73,9 @@ function validate_password(minlength) {
|
||||
document.getElementById("upper").classList.remove("errormsg");
|
||||
// Change the color of the inputbox
|
||||
if (status == false)
|
||||
{
|
||||
password.classList.add("errorinput");
|
||||
}
|
||||
else
|
||||
password.classList.remove("errorinput");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user