Hi, I was assigned a project to write a user information program to help create and maintain user data. One of the parts of the project I am completely stumped on is how to validate the password a user would input...
Tasks are...
Evaluate Password - If either of the following two conditions are true, then the password is not valid,
and fails our evaluation - the password evaluation score in either case, being equal to zero.
1. Length of password must be greater than three characters in length.
2. Password must not be equal to, or contain the user login ID name (this is implemented already)
Otherwise, validate the password according to the following rules. The password score always starts at five,
and is reduced by one point for failing each of the following conditions (3,4,5).
3. Must contain at least one upper case character
4. Must contain at least one lower case character
5. Must contain at least one numerical digit.
6. If the password fails both rules 3 and 4 above, (no upper or lower case) , deduct an additional
point.
Password score examples for user login ID mgriffin
password = dog - score is 0. ( rule 1 )
password = mgriffin399 - score is 0. ( rule 2 )
password = snowball8 - score is 4. ( rule 3 )
password = SNOW22 - score is 4. ( rule 4 )
password = snowball - score is 3. ( rule 3,5 )
password = SnowBall - score is 4. ( rule 5 )
password = 4645376 - score is 1. ( rules 3,4,6 )
Please help! I have all of the project completed except this part...
///Evaluate Password
char temp; //used to store each password character as we loop thru it
bool rule3, rule4, rule5;
/* loop thru password checking each char in order. Is it a digit? If so, set the
flag to true. Initialize our flags (rule1,2,3) below to false before we begin.
ie while looping thru, if we find a digit in there,.. we set rule 3 to true. */
rule3 = false; // false means there are no upper case characters
rule4 = false; // no lower case characters
rule5 = false; // no digits
/// logic for rule 1 and rule 2 (already implemented)
if((password.length() <4 )||( password.find(userLogin)==0)){
passScore =0;
}
else{ //loop through each character in the password
for(int index =0; index <password.length(); index++){
temp = password[index];
///code the logic for rule 3, and rule 4, and rule 5 */
} //end of for loop of each character position
///examine status of rules 3,4,5 to determine the password score
///code the logic here including rule 6!