PHP Classes

Help about JSP

Recommend this page to a friend!

      AJAX Poll  >  All threads  >  Help about JSP  >  (Un) Subscribe thread alerts  
Subject:Help about JSP
Summary:Validating password requirment in JSP
Messages:1
Author:aris aryanto
Date:2007-03-17 11:14:06
 

 


  1. Help about JSP   Reply   Report abuse  
Picture of aris aryanto aris aryanto - 2007-03-17 11:14:06
Dear All,

I need to validate for a strong password with the following requirements:

1. Must be at least 8 characters in length (127 characters max)
2. Must contain at least three (3) of the four (4) following types of characters:
a. Uppercase letters
b. Lowercase letters
c. Numbers
d. Special characters (such as _ # @ $ ^ * etc.)
3. Must not be the same as any of the previous three passwords used

Are there any suggestion?

This is my JSP function, but still cannot use.. cause the special characters have to be put in the end of password value.

<script type="text/javascript">
function Validate()
{
var Password = document.all.new_password1.value;
var Password2 = document.all.new_password2.value;
var minLength = 8;
var re = /^\w*(?=\w*[~,!,@,#,$,%,^,&,*,(,),-,_,=,+,|,\,-,_,+,=,,,.,;,",',?,/,:,[,])(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*/;
if (!re.test(Password))
{
alert("Invalid password!");
return false;
}
if (document.all.new_password1.value.length<minLength)
{
alert("Password have to be 8 characters!");
return false;
}
if (Password != Password2)
{
alert("Password doesn't match!");
return false;
}
else
{
return true;
}
}
</script>

----

Thanxs...

Aris

 
For more information send a message to info at phpclasses dot org.