Skip to content

Commit

Permalink
Merge pull request #56 from AgileBits/fix/the-password-generator-leng…
Browse files Browse the repository at this point in the history
…ths-are-now-respected

We now honor the password generator's minimum and maximum lengths.
  • Loading branch information
roustem committed Aug 13, 2014
2 parents 1ca5d2c + 99ecccf commit a504590
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions OnePasswordExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions OnePasswordExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a504590

Please sign in to comment.