Solved

Password Complexity with validation expressions

Posted on 2004-08-19
5
402 Views
Last Modified: 2008-02-01
This regular expression requires you to enter at least one letter, followed by any number of word characters, followed by at least one number, followed by any number of word characters.

[a-zA-Z]+\w*\d+\w*

Unfortunately, I cannot dictate to the user which placeholder is to be a number or a letter or a special character.  What I really need is the following:

If I have an 8 digit password field, it must meet the following validation:
Minimum of 1 Cap Letter, 1 Special Char, and 1 Numeric

This way I can put this password complexity on the Registration Page where the user creates their own password.

Any ideas?

THank you,
Jayme
0
Comment
Question by:jayme9
  • 2
  • 2
5 Comments
 
LVL 9

Assisted Solution

by:leechoonhwee
leechoonhwee earned 50 total points
ID: 11839122
Well you can add in some function like
Dim NumericCheck as boolean
Dim CapsCheck as boolean
Dim SpecialChar as boolean


for i = 1 to len(strPassword)

if Checknumeric (mid(strpassword,i,1) = false then
NumericCheck=true
end if

if .....check for caps
end if

if ....check for special chars....
end if

next

if NumericCheck = false then  'Doe not satisfy numeric criteria
.....error...
end if
if CapsCheck = false then ' Does not satisfy Caps check
.....error....
end if
if SpecialChars = false then ' Does not satisfy Special char checks
.....error
end if


Function CheckNumeric (strPassword)

if not isnumeric(StrPassword) then
Checknumeric = false
else
Checknumeric = true
end if

End function



thats the gist of it but i dunno how to check for Caps though.....
0
 
LVL 9

Accepted Solution

by:
leechoonhwee earned 50 total points
ID: 11839168
ok got it..... Caps compare is

Function CheckCaps (StrPassword)

if StrComp( strpassword, uCase(Strpassword), vbTextCompare ) = false then
CheckCaps = false
else
CheckCaps = true

end function

0
 

Author Comment

by:jayme9
ID: 11849606
I'll make it even simplier...

Here is the solution that allows the applicant to create their own password that meets the following complexity requirements: at least 8 characters long, with one lower case letter, one upper case letter, one digit, and one special character.

Password field ... On Validate --> Regular Expression Validation -->

^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()+,?./;:"'<=>]).*$

Error msg states "Please enter a valid password."

That's all there is to it.  It works fine.

Jayme
0
 

Expert Comment

by:jra105
ID: 12621268
What if I needed 2 Upper Case 2 Special Charectes 2 Numerals?
0
 

Author Comment

by:jayme9
ID: 12622526
I haven't tried this, but it would be along the lines of this:


^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[1-9]{2,})(?=.*[A-Z]{2,})(?=.*[!@#$%^&*()+,?./;:"'<=>]{2}).*$

It basically says validate a string that is at least 8 characters with:
at least 1 lower case letter (a-z)
at least 2 numbers (1-9)
at least 2 upper case letters (A-Z)
at least 2 special characters within the set (!@#$%^&*()+,?./;:"'<=>)

All that code would go behind your control's OnValidate event that is executed when a user clicks the submit button.  Again, I have not tried it, but it would probably be close to what I have above.

Jayme
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question