From 399fe83452c08e4ad8138aa5f77b80acd4ababab Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Tue, 12 Aug 2014 19:23:35 -0700 Subject: [PATCH 1/2] We now honor the password generator's minimum and maximum lengths. --- OnePasswordExtension.h | 1 + OnePasswordExtension.m | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/OnePasswordExtension.h b/OnePasswordExtension.h index 295a9e0..106e281 100644 --- a/OnePasswordExtension.h +++ b/OnePasswordExtension.h @@ -22,6 +22,7 @@ FOUNDATION_EXPORT NSString *const AppExtensionSectionTitleKey; FOUNDATION_EXPORT NSString *const AppExtensionFieldsKey; FOUNDATION_EXPORT NSString *const AppExtensionReturnedFieldsKey; FOUNDATION_EXPORT NSString *const AppExtensionOldPasswordKey; +FOUNDATION_EXPORT NSString *const AppExtensionPasswordGereratorOptionsKey; // Password Generator options FOUNDATION_EXPORT NSString *const AppExtensionGeneratedPasswordMinLengthKey; diff --git a/OnePasswordExtension.m b/OnePasswordExtension.m index 5daf532..7548bf2 100644 --- a/OnePasswordExtension.m +++ b/OnePasswordExtension.m @@ -24,6 +24,7 @@ NSString *const AppExtensionFieldsKey = @"fields"; NSString *const AppExtensionReturnedFieldsKey = @"returned_fields"; NSString *const AppExtensionOldPasswordKey = @"old_password"; +NSString *const AppExtensionPasswordGereratorOptionsKey = @"password_generator_options"; // WebView Dictionary keys NSString *const AppExtensionWebViewPageFillScript = @"fillScript"; @@ -137,8 +138,10 @@ - (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary #ifdef __IPHONE_8_0 NSMutableDictionary *newLoginAttributesDict = [NSMutableDictionary new]; newLoginAttributesDict[AppExtensionURLStringKey] = URLString; - [newLoginAttributesDict addEntriesFromDictionary:loginDetailsDict]; // TODO: change 1P to use separate dicts - [newLoginAttributesDict addEntriesFromDictionary:passwordGenerationOptions]; + [newLoginAttributesDict addEntriesFromDictionary:loginDetailsDict]; + if (passwordGenerationOptions.count > 0) { + newLoginAttributesDict [AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions; + } __weak typeof (self) miniMe = self; @@ -188,7 +191,9 @@ - (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NS NSMutableDictionary *item = [NSMutableDictionary new]; item[AppExtensionUsernameKey] = username; item[AppExtensionURLStringKey] = URLString; - [item addEntriesFromDictionary:passwordGenerationOptions]; + if (passwordGenerationOptions.count > 0) { + item[AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions; + } __weak typeof (self) miniMe = self; From 99ecccf2a48e9d1774a69c4973c3951ed9e56038 Mon Sep 17 00:00:00 2001 From: Rad Azzouz Date: Tue, 12 Aug 2014 20:15:08 -0700 Subject: [PATCH 2/2] Removed extra space. Nice catch @roustem. --- OnePasswordExtension.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OnePasswordExtension.m b/OnePasswordExtension.m index 7548bf2..b13b4cc 100644 --- a/OnePasswordExtension.m +++ b/OnePasswordExtension.m @@ -140,7 +140,7 @@ - (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary newLoginAttributesDict[AppExtensionURLStringKey] = URLString; [newLoginAttributesDict addEntriesFromDictionary:loginDetailsDict]; if (passwordGenerationOptions.count > 0) { - newLoginAttributesDict [AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions; + newLoginAttributesDict[AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions; } __weak typeof (self) miniMe = self;