public bool ValidatePassword(string password) { PasswordScore passwordStrength = CheckPasswordStrength(password); Debug.WriteLine($"{passwordStrength.ToString()}"); if ((int)passwordStrength >= (int)MinimumPasswordStrength) { return(true); } return(false); }
void passwordchecker() { string test = txt_RegPassword.TextLength.ToString(); String password = test; // Substitute with the user input string PasswordScore passwordStrengthScore = PasswordAdvisor.CheckStrength(password); switch (passwordStrengthScore) { case PasswordScore.Blank: case PasswordScore.VeryWeak: case PasswordScore.Weak: // Show an error message to the user break; case PasswordScore.Medium: case PasswordScore.Strong: case PasswordScore.VeryStrong: // Password deemed strong enough, allow user to be added to database etc break; } MessageBox.Show(passwordStrengthScore.ToString()); }