Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit a504590

Browse files
committed
Merge pull request #56 from AgileBits/fix/the-password-generator-lengths-are-now-respected
We now honor the password generator's minimum and maximum lengths.
2 parents 1ca5d2c + 99ecccf commit a504590

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

OnePasswordExtension.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FOUNDATION_EXPORT NSString *const AppExtensionSectionTitleKey;
2222
FOUNDATION_EXPORT NSString *const AppExtensionFieldsKey;
2323
FOUNDATION_EXPORT NSString *const AppExtensionReturnedFieldsKey;
2424
FOUNDATION_EXPORT NSString *const AppExtensionOldPasswordKey;
25+
FOUNDATION_EXPORT NSString *const AppExtensionPasswordGereratorOptionsKey;
2526

2627
// Password Generator options
2728
FOUNDATION_EXPORT NSString *const AppExtensionGeneratedPasswordMinLengthKey;

OnePasswordExtension.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
NSString *const AppExtensionFieldsKey = @"fields";
2525
NSString *const AppExtensionReturnedFieldsKey = @"returned_fields";
2626
NSString *const AppExtensionOldPasswordKey = @"old_password";
27+
NSString *const AppExtensionPasswordGereratorOptionsKey = @"password_generator_options";
2728

2829
// WebView Dictionary keys
2930
NSString *const AppExtensionWebViewPageFillScript = @"fillScript";
@@ -137,8 +138,10 @@ - (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary
137138
#ifdef __IPHONE_8_0
138139
NSMutableDictionary *newLoginAttributesDict = [NSMutableDictionary new];
139140
newLoginAttributesDict[AppExtensionURLStringKey] = URLString;
140-
[newLoginAttributesDict addEntriesFromDictionary:loginDetailsDict]; // TODO: change 1P to use separate dicts
141-
[newLoginAttributesDict addEntriesFromDictionary:passwordGenerationOptions];
141+
[newLoginAttributesDict addEntriesFromDictionary:loginDetailsDict];
142+
if (passwordGenerationOptions.count > 0) {
143+
newLoginAttributesDict[AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions;
144+
}
142145

143146
__weak typeof (self) miniMe = self;
144147

@@ -188,7 +191,9 @@ - (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NS
188191
NSMutableDictionary *item = [NSMutableDictionary new];
189192
item[AppExtensionUsernameKey] = username;
190193
item[AppExtensionURLStringKey] = URLString;
191-
[item addEntriesFromDictionary:passwordGenerationOptions];
194+
if (passwordGenerationOptions.count > 0) {
195+
item[AppExtensionPasswordGereratorOptionsKey] = passwordGenerationOptions;
196+
}
192197

193198
__weak typeof (self) miniMe = self;
194199

0 commit comments

Comments
 (0)