mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-22 02:58:11 +00:00
fix(vulnerability): properly change the totp code after disabling it
This commit is contained in:
1 parent
e821b20f87
commit
83d4c522f8
6 files changed
+138
-11
No files matched your search
@@ -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"];
|
||||
|
||||
Reference in new issue
Block a user