Solved

Password Complexity with validation expressions

Posted on 2004-08-19
5
404 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CDO.Message not able to send attachement 5 42
Save ms data to server side. 19 62
Extracting nodes  using classical ASP 3 38
PHP $_POST vs asp request 4 53
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…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

742 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