fix(calendar,preferences) Small fixes for commit 5c4d467d and 6050c4ee

This commit is contained in:
Hivert Quentin
2023-05-22 10:11:58 +02:00
parent 5c4d467d06
commit e076d0db73
6 changed files with 21 additions and 28 deletions
+11 -19
View File
@@ -60,7 +60,7 @@ static const NSString *SPECIAL_SYMBOL_ALLOWED = @"%$&*(){}!?\\@#.,:;+=";
return [NSArray arrayWithObjects: [NSString stringWithFormat:@"(.*[a-z].*){%i}", [count intValue]],
[NSString stringWithFormat:@"(.*[A-Z].*){%i}", [count intValue]],
[NSString stringWithFormat:@"(.*[0-9].*){%i}", [count intValue]],
[NSString stringWithFormat:@"([%%%@].*){%i,}", SPECIAL_SYMBOL_ALLOWED, [count intValue]],
[NSString stringWithFormat:@"([%@].*){%i,}", SPECIAL_SYMBOL_ALLOWED, [count intValue]],
[NSString stringWithFormat:@".{%i,}", [count intValue]],
nil];
}
@@ -99,25 +99,17 @@ static const NSString *SPECIAL_SYMBOL_ALLOWED = @"%$&*(){}!?\\@#.,:;+=";
if ([[self policies] containsObject: label]) {
NSNumber *value = [policy objectForKey:@"value"];
if (0 < value) {
if (![POLICY_MIN_SPECIAL_SYMBOLS isEqualToString: label]) {
NSString *newLabel = [[translations objectForKey: label]
stringByReplacingOccurrencesOfString: @"%{0}"
withString: [value stringValue]];
[userTranslatedPasswordPolicy addObject:[NSDictionary dictionaryWithObjectsAndKeys:
newLabel, @"label",
[policy objectForKey:@"regex"], @"regex",
nil]];
} else {
NSString *newLabel = [[[[translations objectForKey: label]
stringByReplacingOccurrencesOfString: @"%{0}"
withString: [value stringValue]]
stringByAppendingString: @" "]
stringByAppendingString: SPECIAL_SYMBOL_ALLOWED];
[userTranslatedPasswordPolicy addObject:[NSDictionary dictionaryWithObjectsAndKeys:
newLabel, @"label",
[policy objectForKey:@"regex"], @"regex",
nil]];
NSString *newLabel = [[translations objectForKey: label]
stringByReplacingOccurrencesOfString: @"%{0}"
withString: [value stringValue]];
if ([POLICY_MIN_SPECIAL_SYMBOLS isEqualToString: label]) {
newLabel = [[newLabel stringByAppendingString: @" "]
stringByAppendingString: SPECIAL_SYMBOL_ALLOWED];
}
[userTranslatedPasswordPolicy addObject:[NSDictionary dictionaryWithObjectsAndKeys:
newLabel, @"label",
[policy objectForKey:@"regex"], @"regex",
nil]];
} else {
// Do nothing
}