diff --git a/MacPass/Base.lproj/PasswordInputView.xib b/MacPass/Base.lproj/PasswordInputView.xib index 60439661..2f2ddf44 100644 --- a/MacPass/Base.lproj/PasswordInputView.xib +++ b/MacPass/Base.lproj/PasswordInputView.xib @@ -7,6 +7,7 @@ + @@ -46,15 +47,6 @@ DQ - - - - - - - - - @@ -114,14 +106,20 @@ DQ + - - @@ -132,13 +130,16 @@ DQ - + + + + diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 1f4ddf83..5346157b 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -235,7 +235,8 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { BOOL isUnlocked = (nil != self.tree); if(isUnlocked) { [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidUnlockDatabaseNotification object:self]; - if([password length] > 0 && self.isAllowedToStoreKeyFile) { + /* Make sure to only store */ + if(self.compositeKey.hasPassword && self.isAllowedToStoreKeyFile) { [self _storeKeyURL:keyFileURL]; } } diff --git a/MacPass/MPPasswordInputController.m b/MacPass/MPPasswordInputController.m index 0c7144e9..faa236f5 100644 --- a/MacPass/MPPasswordInputController.m +++ b/MacPass/MPPasswordInputController.m @@ -23,8 +23,10 @@ @property (weak) IBOutlet NSImageView *errorImageView; @property (weak) IBOutlet NSTextField *errorInfoTextField; @property (weak) IBOutlet NSButton *togglePasswordButton; +@property (weak) IBOutlet NSButton *enablePasswordCheckBox; @property (assign) BOOL showPassword; +@property (assign) BOOL enablePassword; @end @@ -38,6 +40,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if(self) { + _enablePassword = YES; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_selectKeyURL) name:MPDocumentDidChangeStoredKeyFilesSettings object:nil]; } return self; @@ -52,6 +55,9 @@ [self.errorImageView setImage:[NSImage imageNamed:NSImageNameCaution]]; [self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil]; [self.togglePasswordButton bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil]; + [self.enablePasswordCheckBox bind:NSValueBinding toObject:self withKeyPath:@"enablePassword" options:nil]; + [self.togglePasswordButton bind:NSEnabledBinding toObject:self withKeyPath:@"enablePassword" options:nil]; + [self.passwordTextField bind:NSEnabledBinding toObject:self withKeyPath:@"enablePassword" options:nil]; [self _reset]; } @@ -70,7 +76,9 @@ MPDocument *document = [[self windowController] document]; if(document) { NSError *error = nil; - if(![document unlockWithPassword:[self.passwordTextField stringValue] + /* No password is different than an empty password */ + NSString *password = self.enablePassword ? [self.passwordTextField stringValue] : nil; + if(![document unlockWithPassword:password keyFileURL:[self.keyPathControl URL] error:&error]) { [self _showError:error]; @@ -84,6 +92,7 @@ - (void)_reset { self.showPassword = NO; + self.enablePassword = YES; [self.passwordTextField setStringValue:@""]; [self.errorInfoTextField setHidden:YES]; [self.errorImageView setHidden:YES]; diff --git a/MacPass/PasswordEditWindow.xib b/MacPass/PasswordEditWindow.xib index 3d68a9cb..fefc4d70 100644 --- a/MacPass/PasswordEditWindow.xib +++ b/MacPass/PasswordEditWindow.xib @@ -21,26 +21,14 @@ - - + + - + - - - - - - - - - - - - - + @@ -51,7 +39,7 @@ - + @@ -60,8 +48,11 @@ - + @@ -105,7 +96,7 @@ - + @@ -114,7 +105,7 @@ - + @@ -126,7 +117,7 @@ - + @@ -138,7 +129,7 @@ + - - - - - @@ -181,18 +175,27 @@ Gw - - - - + + + + + + + + + + + + +