marchnw
05-29-2008, 09:06 AM
I have the function below trying to validate my password standards. I have never used a function in asp before. How do I call and run the fuction? Is it different than a sub-routine?
Function ValidatePassword(sPW)
If Len(sPW) < 8 OR Len(sPW) > 26 Then
ValidatePassword = "Password must be between 8 and 26 characters in length"
Exit Function
End If
Dim okay : okay = 0
Dim vre
Set vre = New RegExp
vre.Pattern = "[a-z]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[A-Z]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[0-9]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[\?\.\,\_\-\~\+\=\&\!]"
If vre.Test( sPW ) Then okay = okay + 1
If okay < 3 Then
ValidatePassword = "Your password is not strong enough. See the guidelines."
Else
ValidatePassword = ""
End If
End Function
Function ValidatePassword(sPW)
If Len(sPW) < 8 OR Len(sPW) > 26 Then
ValidatePassword = "Password must be between 8 and 26 characters in length"
Exit Function
End If
Dim okay : okay = 0
Dim vre
Set vre = New RegExp
vre.Pattern = "[a-z]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[A-Z]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[0-9]"
If vre.Test( sPW ) Then okay = okay + 1
vre.Pattern = "[\?\.\,\_\-\~\+\=\&\!]"
If vre.Test( sPW ) Then okay = okay + 1
If okay < 3 Then
ValidatePassword = "Your password is not strong enough. See the guidelines."
Else
ValidatePassword = ""
End If
End Function