summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/LoginViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-05 01:40:51 +0300
committerGravatar Vitaly Takmazov2017-12-05 01:40:51 +0300
commita228ce07cc5413a6ba164c12042ab1e4028aa5b3 (patch)
treef1e8eafe6ebcf9beebd9a0ebdd4a1f8d591f8698 /Juick/ViewControllers/LoginViewController.m
parent888cbddb1eaab4f4f343ffd6e0bf8d976b579794 (diff)
comment
Diffstat (limited to 'Juick/ViewControllers/LoginViewController.m')
-rw-r--r--Juick/ViewControllers/LoginViewController.m35
1 files changed, 10 insertions, 25 deletions
diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m
index 640cd10..a65d180 100644
--- a/Juick/ViewControllers/LoginViewController.m
+++ b/Juick/ViewControllers/LoginViewController.m
@@ -16,10 +16,6 @@
- (void) awakeFromNib {
[super awakeFromNib];
- [self initializeForm];
-}
-
-- (void)initializeForm {
self.title = @"Sign in";
[self.view setBackgroundColor:[ColorScheme mainBackground]];
@@ -27,22 +23,8 @@
target:self action:@selector(cancelSignIn)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self action:@selector(doneSignIn)];
- XLFormDescriptor *form = [XLFormDescriptor formDescriptorWithTitle:@"Sign in"];
- form.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
- XLFormSectionDescriptor *section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- XLFormRowDescriptor * usernameRow = [XLFormRowDescriptor
- formRowDescriptorWithTag:@"com.juick.username"
- rowType:XLFormRowDescriptorTypeText title:@"Username"];
- usernameRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"];
- [section addFormRow:usernameRow];
- XLFormRowDescriptor * passwordRow = [XLFormRowDescriptor
- formRowDescriptorWithTag:@"com.juick.password"
- rowType:XLFormRowDescriptorTypePassword title:@"Password"];
- passwordRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"];
- [section addFormRow:passwordRow];
-
- self.form = form;
+ self.usernameField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"];
+ self.passwordField.text = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"];
}
@@ -76,12 +58,15 @@
}];
}
-
--(void) formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue {
- [super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
- if ([newValue isKindOfClass:[NSString class]]) {
- [[PDKeychainBindings sharedKeychainBindings] setObject:newValue forKey:formRow.tag];
+- (IBAction)passwordChanged:(id)sender {
+ if ([self.passwordField.text isKindOfClass:[NSString class]]) {
+ [[PDKeychainBindings sharedKeychainBindings] setObject:self.passwordField.text forKey:@"com.juick.password"];
}
}
+- (IBAction)usernameChanged:(id)sender {
+ if ([self.usernameField.text isKindOfClass:[NSString class]]) {
+ [[PDKeychainBindings sharedKeychainBindings] setObject:self.usernameField.text forKey:@"com.juick.username"];
+ }
+}
@end