Bugfix & add check for whether to use custom string or not

Remove local scope variable hiding the one in function scope.
Also did not check for the state of the custom characters button.
This commit is contained in:
Patrik Thunström
2016-04-21 00:27:33 +02:00
parent 1e3e3e141c
commit 2c1eb61682

View File

@@ -106,14 +106,14 @@ static NSString *mergeWithoutDuplicates(NSString* baseCharacters, NSString* cust
- (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters {
NSString *characters = nil;
if(nil == customCharacters) {
characters = allowedCharactersString(allowedCharacters);
}
else {
NSString *characters = mergeWithoutDuplicates(
if([[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyPasswordUseCustomString] && nil != customCharacters) {
characters = mergeWithoutDuplicates(
allowedCharactersString(allowedCharacters),
customCharacters);
}
else {
characters = allowedCharactersString(allowedCharacters);
}
CGFloat alphabetCount = characters.length;
CGFloat passwordLength = self.length;
return passwordLength * ( log10(alphabetCount) / log10(2) );