feat(password): added a password reset page (and unused form), corrected the validation of the password changer, modified styles
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,8 +1,34 @@
|
||||
function validate_form(minlength) {
|
||||
function validate_username_form(minlength) {
|
||||
var user = validate_username();
|
||||
var pass = validate_password(minlength);
|
||||
|
||||
return validate_confirm() && pass && user;
|
||||
if (validate_confirm() && pass && user) {
|
||||
disable_submit(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
disable_submit(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
function disable_submit(status) {
|
||||
document.getElementById("submit").disabled = status;
|
||||
}
|
||||
|
||||
function validate_email() {
|
||||
var email = document.getElementById("email");
|
||||
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
|
||||
if (re.test(email.value) != true) {
|
||||
disable_submit(true);
|
||||
email.classList.add("errorinput");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
disable_submit(false);
|
||||
email.classList.remove("errorinput");
|
||||
return true;
|
||||
}
|
||||
|
||||
function validate_confirm() {
|
||||
@@ -25,15 +51,16 @@ function validate_username() {
|
||||
var username = document.getElementById("username");
|
||||
var forbidden = /[*?!'\^+%\&/()=}{\$#;,\\"]+/;
|
||||
|
||||
if (username.value.length > 64 || forbidden.test(username.value) == true)
|
||||
{
|
||||
if (username.value.length > 64 || forbidden.test(username.value) == true) {
|
||||
document.getElementById("username-msg").classList.add("errormsg");
|
||||
username.classList.add("errorinput");
|
||||
disable_submit(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
document.getElementById("username-msg").classList.remove("errormsg");
|
||||
username.classList.remove("errorinput");
|
||||
disable_submit(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,8 +70,7 @@ function validate_password(minlength) {
|
||||
// Target element
|
||||
var password = document.getElementById("newpassword");
|
||||
// Check the length
|
||||
if (password.value.length < minlength)
|
||||
{
|
||||
if (password.value.length < minlength) {
|
||||
status = false;
|
||||
document.getElementById("minlen").classList.add("errormsg");
|
||||
}
|
||||
@@ -71,11 +97,10 @@ function validate_password(minlength) {
|
||||
}
|
||||
else
|
||||
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