From 28bd162e058ebba91ca2578e545e89578dde0e1d Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Tue, 5 Jul 2016 20:15:18 -0400 Subject: [PATCH] Fixed issue when signing out on iOS + issue with biometrics not getting enabled properly after enabling TouchID. --- MasterPassword/ObjC/MPAppDelegate_Key.m | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/MasterPassword/ObjC/MPAppDelegate_Key.m b/MasterPassword/ObjC/MPAppDelegate_Key.m index 79b08327..f681f65d 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Key.m +++ b/MasterPassword/ObjC/MPAppDelegate_Key.m @@ -78,6 +78,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi if (user.saveKey) { inf( @"Saving key in keychain for user: %@", user.userID ); + [self forgetSavedKeyFor:user]; [PearlKeyChain addOrUpdateItemForQuery:createKeyQuery( user, YES, nil ) withAttributes:@{ (__bridge id)kSecValueData : [self.key keyDataForAlgorithm:user.algorithm], @@ -100,6 +101,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi if (self.key) self.key = nil; + self.activeUser = nil; [[NSNotificationCenter defaultCenter] postNotificationName:MPSignedOutNotification object:self userInfo:@{ @"animated" : @(animated) }]; } @@ -171,15 +173,7 @@ static NSDictionary *createKeyQuery(MPUserEntity *user, BOOL newItem, MPKeyOrigi self.key = tryKey; // Update the key chain if necessary. - switch (self.key.origin) { - case MPKeyOriginMasterPassword: - [self storeSavedKeyFor:user]; - break; - - case MPKeyOriginKeyChain: - case MPKeyOriginKeyChainBiometric: - break; - } + [self storeSavedKeyFor:user]; } @try {