Hello, I really hope someone can help me with this. I'm new to Javascript, so I really don't know where to start...
I've been looking extensively online and on this forum on how to apply these requirements to the Hikashop registration page:
- The password to successfully register must be at least 8 characters long
- Must consist of at least one Uppercase, Lowercase, Number and Non-alpha numeric character
I'm pretty sure the file I need to be editing is hikashop.js and the code that needs to be added is:
if (password.length < 8)
alert("bad password");
var hasUpperCase = /[A-Z]/.test(password);
var hasLowerCase = /[a-z]/.test(password);
var hasNumbers = /\d/.test(password);
var hasNonalphas = /\W/.test(password);
if (hasUpperCase + hasLowerCase + hasNumbers + hasNonalphas < 3)
alert("bad password");
This is the code that is currently there:
if(type=='register'){
//check password
if(typeof varform.elements['data[register][password]'] != 'undefined' && typeof varform.elements['data[register][password2]'] != 'undefined'){
passwd = varform.elements['data[register][password]'];
passwd2 = varform.elements['data[register][password2]'];
if(passwd.value!=passwd2.value){
alert(hikashop['password_different']);
return false;
}
}
Where inside this code would I place the modification to achieve the desired effect?