Refactored password handling in Document. Now only the composite key is stored and not the plain password and key file URL. This for now breaks the change password dialog a bit. Needs to be addressed.

Started conceptualising for auto type functionality
This commit is contained in:
michael starke
2013-10-31 21:10:10 +01:00
parent 55b4ce648f
commit 8f6622102b
18 changed files with 399 additions and 106 deletions

View File

@@ -14,6 +14,7 @@
#import "NSData+Keyfile.h"
#import "KPKTree.h"
#import "KPKCompositeKey.h"
@interface MPPasswordEditWindowController ()
@@ -47,9 +48,10 @@
return;
}
self.showPassword = NO;
[self.passwordTextField setStringValue:_currentDocument.password ? _currentDocument.password : @""];
[self.passwordRepeatTextField setStringValue:[self.passwordTextField stringValue]];
self.keyURL = _currentDocument.key;
// TODO: fix initial view for password edit
//[self.passwordTextField setStringValue:_currentDocument.password ? _currentDocument.password : @""];
//[self.passwordRepeatTextField setStringValue:[self.passwordTextField stringValue]];
//self.keyURL = _currentDocument.key;
NSDictionary *negateOption = @{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName };
[self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil];
@@ -82,8 +84,7 @@
#pragma mark Actions
- (IBAction)save:(id)sender {
_currentDocument.password = [self.passwordTextField stringValue];
_currentDocument.key = [self.keyfilePathControl URL];
_currentDocument.compositeKey = [[KPKCompositeKey alloc] initWithPassword:[self.passwordTextField stringValue] key:[self.keyfilePathControl URL]];
[self dismissSheet:NSRunStoppedResponse];
if(self.delegate && [self.delegate respondsToSelector:@selector(didFinishPasswordEditing:)]) {
[self.delegate didFinishPasswordEditing:YES];