diff --git a/US2FormValidationFramework/source/conditions/US2ConditionPassword.h b/US2FormValidationFramework/source/conditions/US2ConditionPassword.h index 72a4f38..5034e76 100644 --- a/US2FormValidationFramework/source/conditions/US2ConditionPassword.h +++ b/US2FormValidationFramework/source/conditions/US2ConditionPassword.h @@ -37,6 +37,7 @@ typedef enum US2PasswordStrengthMedium = 2, US2PasswordStrengthStrong = 3, US2PasswordStrengthVeryStrong = 4, + US2PasswordMatchesAll = 5, } US2PasswordStrength; @@ -58,7 +59,8 @@ typedef enum US2PasswordStrengthWeak = 1, US2PasswordStrengthMedium = 2, US2PasswordStrengthStrong = 3, - US2PasswordStrengthVeryStrong = 4, // All criteria is matched + US2PasswordStrengthVeryStrong = 4, + US2PasswordMatchesAll = 5, // All criteria is matched If the password strength matches or is above the required strength than the condition will pass. */ @@ -98,7 +100,8 @@ typedef enum * US2PasswordStrengthWeak * US2PasswordStrengthMedium (Default Value) * US2PasswordStrengthStrong - * US2PasswordStrengthVeryStrong (All criteria is matched) + * US2PasswordStrengthVeryStrong + * US2PasswordMatchesAll (All criteria is matched) */ @property (nonatomic) US2PasswordStrength requiredStrength; diff --git a/US2FormValidationFramework/source/conditions/US2ConditionPassword.m b/US2FormValidationFramework/source/conditions/US2ConditionPassword.m index ba9af06..368bb0d 100644 --- a/US2FormValidationFramework/source/conditions/US2ConditionPassword.m +++ b/US2FormValidationFramework/source/conditions/US2ConditionPassword.m @@ -81,23 +81,23 @@ - (NSUInteger)US2__strengthOfPasswordString:(NSString *)string NSUInteger specialCharacterMatchesCount = [self US2__numberOfSpecialCharactersInString:string]; // For each match of each type, move the strength value up one (higher = stronger) - if (numberMatchesCount > _minimalNumbers) - { + if (numberMatchesCount >= _minimalNumbers) + { strength++; } - if (lowercaseMatchesCount > _minimalLowerCase) - { + if (lowercaseMatchesCount >= _minimalLowerCase) + { strength++; } - if (uppercaseMatchesCount > _minimalUpperCase) - { + if (uppercaseMatchesCount >= _minimalUpperCase) + { strength++; } - if (specialCharacterMatchesCount > _minimalSymbols) - { + if (specialCharacterMatchesCount >= _minimalSymbols) + { strength++; } diff --git a/US2FormValidationFramework/source/validators/US2ValidatorPassword.h b/US2FormValidationFramework/source/validators/US2ValidatorPassword.h index cfcb7a0..1e0f3cd 100644 --- a/US2FormValidationFramework/source/validators/US2ValidatorPassword.h +++ b/US2FormValidationFramework/source/validators/US2ValidatorPassword.h @@ -69,7 +69,8 @@ * US2PasswordStrengthWeak * US2PasswordStrengthMedium (Default Value) * US2PasswordStrengthStrong - * US2PasswordStrengthVeryStrong (All criteria is matched) + * US2PasswordStrengthVeryStrong + * US2PasswordMatchesAll (All criteria is matched) */ @property (nonatomic) US2PasswordStrength requiredStrength;