diff options
author | Vitaly Takmazov | 2018-12-25 10:37:21 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-12-25 10:44:07 +0300 |
commit | c22688421066a358b1980f4399f421000febdaac (patch) | |
tree | f48ac07d5e95b79e928cba1dc89f55e2517f07ed /Juick/ViewControllers/LoginViewController.m | |
parent | da64667f6ef19bfeedb8b4b40d875fcd10d4ef6c (diff) |
PDKeychainBindingsController -> SAMKeychain
Diffstat (limited to 'Juick/ViewControllers/LoginViewController.m')
-rw-r--r-- | Juick/ViewControllers/LoginViewController.m | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index 917d563..c0b1a0d 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -28,8 +28,8 @@ target:self action:@selector(cancelSignIn)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(doneSignIn)]; - self.usernameField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"]; - self.passwordField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]; + self.usernameField.text = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; + self.passwordField.text = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"];; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; } @@ -58,7 +58,9 @@ - (void) doneSignIn { [User checkIsValid:^(BOOL success) { if (success) { - [[APIClient sharedClient].manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; + NSString *username = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; + NSString *password = [SAMKeychain passwordForService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"]; + [[APIClient sharedClient].manager.requestSerializer setAuthorizationHeaderFieldWithUsername:username password:password]; AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; [app registerForRemoteNotifications]; @@ -77,13 +79,13 @@ } - (IBAction)passwordChanged:(id)sender { if ([self.passwordField.text isKindOfClass:[NSString class]]) { - [[PDKeychainBindings sharedKeychainBindings] setObject:self.passwordField.text forKey:@"com.juick.password"]; + [SAMKeychain setPassword:self.passwordField.text forService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.password"]; } } - (IBAction)usernameChanged:(id)sender { if ([self.usernameField.text isKindOfClass:[NSString class]]) { - [[PDKeychainBindings sharedKeychainBindings] setObject:self.usernameField.text forKey:@"com.juick.username"]; + [SAMKeychain setPassword:self.usernameField.text forService:[[NSBundle mainBundle] bundleIdentifier] account:@"com.juick.username"]; } } @end |