1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
int main()
{
string password;
bool validUpper = false, validNumber = false, validLower = false, validLength = false, firstPass = false, success = false;
while(success == false){
user_prompt(password);
validate(password, validUpper, validNumber, validLower, validLength, firstPass);
warning(password, validUpper, validNumber, validLower, validLength, firstPass);
confirm_valid(password, firstPass, success);
}
return 0;
}
bool confirm_valid(string password, bool firstPass, bool success)
{
string confirmPassword;
if (firstPass == true)
{
cout << "Re-enter the password for validation:";
cin >> confirmPassword;
if(confirmPassword != password)
{
cout << endl;
cout << "<<< This password \"" << confirmPassword << "\" does not match \"" <<
password << "\" >>>";
success = false;
}
else
{
cout << endl << "*** The password has been approved ***" << endl;
success = true;
}
}
return success;
}
|