fix(vulnerability): properly change the totp code after disabling it

This commit is contained in:
Hivert Quentin committed 2026-02-25 15:23:57 +01:00
1 parent e821b20f87
commit 83d4c522f8
6 files changed
+138 -11

No files matched your search

+36
View File
@@ -116,6 +116,42 @@ static Class SOGoUserProfileKlass = Nil;
return salt;
}
- (NSString *) userCurrentTotpKey: (bool) renew
{
NSMutableDictionary *values;
NSString *key;
key = [[self dictionaryForKey: @"General"] objectForKey: @"totpKey"];
if (!key || renew)
{
key = [[[[NSProcessInfo processInfo] globallyUniqueString] asSHA1String] substringToIndex: 20];
values = [self objectForKey: @"General"];
if (!values)
values = [NSMutableDictionary dictionary];
[values setObject: key forKey: @"totpKey"];
[self setObject: values forKey: @"General"];
[self synchronize];
}
return key;
}
- (void) setTotpKey: (NSString* ) newKey
{
NSMutableDictionary *values;
values = [self objectForKey: @"General"];
if (!values)
values = [NSMutableDictionary dictionary];
[values setObject: newKey forKey: @"totpKey"];
[self setObject: values forKey: @"General"];
[self synchronize];
}
- (void) enableForceResetPassword
{
[self setObject: [NSNumber numberWithInt:1] forKey: @"ForceResetPassword"];