mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-24 11:09:50 +00:00
Added support for both standard and custom characters sets
This commit is contained in:
@@ -42,7 +42,9 @@ static NSString *allowedCharactersString(MPPasswordCharacterFlags flags) {
|
||||
return password;
|
||||
}
|
||||
|
||||
+ (NSString *)passwordWithCharactersets:(MPPasswordCharacterFlags)allowedCharacters length:(NSUInteger)length {
|
||||
+ (NSString *)passwordWithCharactersets:(MPPasswordCharacterFlags)allowedCharacters
|
||||
withCustomCharacters:(NSString*)customCharacters
|
||||
length:(NSUInteger)length {
|
||||
NSMutableString *password = [NSMutableString stringWithCapacity:length];
|
||||
NSString *characters = allowedCharactersString(allowedCharacters);
|
||||
while([password length] < length) {
|
||||
@@ -67,7 +69,9 @@ static NSString *allowedCharactersString(MPPasswordCharacterFlags flags) {
|
||||
if(useCustomString && [customString length] > 0) {
|
||||
return [customString passwordWithLength:passwordLength];
|
||||
}
|
||||
return [NSString passwordWithCharactersets:characterFlags length:passwordLength];
|
||||
return [NSString passwordWithCharactersets:characterFlags
|
||||
withCustomCharacters:@""
|
||||
length:passwordLength];
|
||||
}
|
||||
|
||||
- (NSString *)passwordWithLength:(NSUInteger)length {
|
||||
|
||||
Reference in New Issue
Block a user