Enhanced error display of password input view. Now aloe localized errors are reported (this needs to be filtered, as the user doesn't need to know all the details)

This commit is contained in:
michael starke
2013-09-04 21:26:46 +02:00
parent b162fcb7c3
commit 34f031a372

View File

@@ -12,6 +12,7 @@
#import "MPKeyfilePathControlDelegate.h" #import "MPKeyfilePathControlDelegate.h"
#import "HNHRoundedSecureTextField.h" #import "HNHRoundedSecureTextField.h"
#import "NSError+Messages.h"
@interface MPPasswordInputController () @interface MPPasswordInputController ()
@@ -60,9 +61,11 @@
id windowController = [[[self view] window] windowController]; id windowController = [[[self view] window] windowController];
MPDocument *document = [windowController document]; MPDocument *document = [windowController document];
if(document) { if(document) {
NSError *error = nil;
if(![document unlockWithPassword:[self.passwordTextField stringValue] if(![document unlockWithPassword:[self.passwordTextField stringValue]
keyFileURL:[self.keyPathControl URL]]) { keyFileURL:[self.keyPathControl URL]
[self _showError]; error:&error]) {
[self _showError:error];
} }
else { else {
[windowController showEntries]; [windowController showEntries];
@@ -83,7 +86,11 @@
} }
- (void)_showError { - (void)_showError:(NSError *)error {
if(error) {
NSString *errorMessage = [error descriptionForErrorCode];
[self.errorInfoTextField setStringValue:errorMessage];
}
[self.errorImageView setHidden:NO]; [self.errorImageView setHidden:NO];
[self.errorInfoTextField setHidden:NO]; [self.errorInfoTextField setHidden:NO];
} }