File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -152,4 +152,6 @@ extern NSString *const kNewsFeedStoryBoardKey;
152152 */
153153- (void ) resetAppAndProceedToSignIn ;
154154
155+ - (void ) clearPreviousUserData ;
156+
155157@end
Original file line number Diff line number Diff line change @@ -1246,17 +1246,21 @@ - (void) resetAppAndProceedToSignIn
12461246 UIViewController * vc = [[UIViewController alloc ] init ];
12471247 vc.view .backgroundColor = [UIColor whiteColor ];
12481248 appDelegate.window .rootViewController = vc;
1249-
1250- // Clear all user info, in case they log in or sign up as a different user afterwards
1251- [appDelegate clearNSUserDefaults ];
1252- [APCKeychainStore resetKeyChain ];
1253- [appDelegate.dataSubstrate resetCoreData ];
1254-
1249+
12551250 // This is all that is needed to force the re-registration of the PIN
12561251 APCUser* user = [((id <APCOnboardingManagerProvider>)appDelegate) onboardingManager ].user ;
12571252 user.secondaryInfoSaved = NO ;
12581253
12591254 [self logOutAndGoToSignIn ];
12601255}
12611256
1257+ - (void ) clearPreviousUserData
1258+ {
1259+ // Clear all user info, in case they log in or sign up as a different user afterwards
1260+ APCAppDelegate * appDelegate = (APCAppDelegate*) [UIApplication sharedApplication ].delegate ;
1261+ [appDelegate clearNSUserDefaults ];
1262+ [APCKeychainStore resetKeyChain ];
1263+ [appDelegate.dataSubstrate resetCoreData ];
1264+ }
1265+
12621266@end
Original file line number Diff line number Diff line change @@ -177,9 +177,14 @@ - (void) signIn
177177
178178 APCUser * user = [self user ];
179179
180- user.email = self.userHandleTextField .text ;
180+ if (user.email != nil && ![user.email isEqualToString: self .userHandleTextField.text] ) {
181+ // Trying to log in as a different user, so clear cached data from the previously logged in user
182+ [((APCAppDelegate*)[UIApplication sharedApplication ].delegate) clearPreviousUserData ];
183+ }
181184
185+ user.email = self.userHandleTextField .text ;
182186 user.password = self.passwordTextField .text ;
187+
183188 [user signInOnCompletion: ^(NSError *error) {
184189 if (error) {
185190 [spinnerController dismissViewControllerAnimated: YES completion: ^{
You can’t perform that action at this time.
0 commit comments