diff --git a/MacPass/Base.lproj/PasswordInputView.xib b/MacPass/Base.lproj/PasswordInputView.xib
index aa2f66f0..f3cc9a4f 100644
--- a/MacPass/Base.lproj/PasswordInputView.xib
+++ b/MacPass/Base.lproj/PasswordInputView.xib
@@ -152,7 +152,7 @@ Gw
-
+
diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m
index 43313337..ebcd16c8 100644
--- a/MacPass/MPAutotypeDaemon.m
+++ b/MacPass/MPAutotypeDaemon.m
@@ -22,6 +22,7 @@
#import "MPAutotypeDaemon.h"
#import "MPDocument.h"
+#import "MPDocumentWindowController.h"
#import "MPAutotypeCommand.h"
#import "MPAutotypeContext.h"
#import "MPAutotypePaste.h"
@@ -208,7 +209,10 @@ static MPAutotypeDaemon *_sharedInstance;
[NSApp activateIgnoringOtherApps:YES];
[NSApp.mainWindow makeKeyAndOrderFront:self];
/* show the actual document window to the user */
- [documents.firstObject showWindows];
+ MPDocument *document = documents.firstObject;
+ [document showWindows];
+ MPDocumentWindowController *wc = document.windowControllers.firstObject;
+ [wc showPasswordInputWithMessage:NSLocalizedString(@"AUTOTYPE_MESSAGE_UNLOCK_DATABASE", @"Message displayed to the user to unlock the database to perform global autotype")];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didUnlockDatabase:) name:MPDocumentDidUnlockDatabaseNotification object:nil];
return; // wait for the unlock to happen
}
diff --git a/MacPass/MPDocumentWindowController.h b/MacPass/MPDocumentWindowController.h
index 406c8dfd..1cc2cccb 100644
--- a/MacPass/MPDocumentWindowController.h
+++ b/MacPass/MPDocumentWindowController.h
@@ -44,6 +44,7 @@
- (void)showEntries;
- (void)showPasswordInput;
+- (void)showPasswordInputWithMessage:(NSString *)message;
- (void)editPasswordWithCompetionHandler:(void (^)(NSInteger result))handler;
#pragma mark Actions
diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m
index b216a609..343b8e3a 100644
--- a/MacPass/MPDocumentWindowController.m
+++ b/MacPass/MPDocumentWindowController.m
@@ -285,7 +285,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
if(![menuItem.representedObject isKindOfClass:NSDictionary.class]) {
return;
}
-
+
NSWindow *sheetWindow = ((MPDocument *)self.document).windowForSheet;
if(!sheetWindow) {
return;
@@ -323,15 +323,19 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
}
- (void)showPasswordInput {
+ [self showPasswordInputWithMessage:nil];
+}
+- (void)showPasswordInputWithMessage:(NSString *)message {
if(!self.passwordInputController) {
self.passwordInputController = [[MPPasswordInputController alloc] init];
}
[self _setContentViewController:self.passwordInputController];
- [self.passwordInputController requestPasswordWithCompletionHandler:^BOOL(NSString *password, NSURL *keyURL, BOOL cancel, NSError *__autoreleasing *error) {
- if(cancel) {
+ [self.passwordInputController requestPasswordWithMessage:message cancelLabel:nil completionHandler:^BOOL(NSString *password, NSURL *keyURL, BOOL didCancel, NSError *__autoreleasing *error) {
+ if(didCancel) {
return NO;
}
return [((MPDocument *)self.document) unlockWithPassword:password keyFileURL:keyURL error:error];
+
}];
}
diff --git a/MacPass/MPPasswordInputController.m b/MacPass/MPPasswordInputController.m
index 4be0225a..62266d0a 100644
--- a/MacPass/MPPasswordInputController.m
+++ b/MacPass/MPPasswordInputController.m
@@ -153,8 +153,12 @@
self.messageInfoTextField.hidden = (nil == self.message);
if(self.message) {
self.messageInfoTextField.stringValue = self.message;
+ self.messageImageView.image = [NSImage imageNamed:NSImageNameInfo];
}
- self.messageImageView.hidden = (nil == self.message);;
+ else {
+ self.messageImageView.image = [NSImage imageNamed:NSImageNameCaution];
+ }
+ self.messageImageView.hidden = (nil == self.message);
self.cancelButton.hidden = (nil == self.cancelLabel);
if(self.cancelLabel) {
self.cancelButton.stringValue = self.cancelLabel;
@@ -172,6 +176,7 @@
self.messageInfoTextField.stringValue = error.descriptionForErrorCode;
}
self.messageImageView.hidden = NO;
+ self.messageImageView.image = [NSImage imageNamed:NSImageNameCaution];
self.messageInfoTextField.hidden = NO;
}
diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings
index 08edf87b..724846e7 100644
--- a/MacPass/en.lproj/Localizable.strings
+++ b/MacPass/en.lproj/Localizable.strings
@@ -74,6 +74,9 @@
/* Inherit autotype settings menu item */
"AUTOTYPE_INHERIT" = "Inherit Autotype Settings";
+/* Message displayed to the user to unlock the database to perform global autotype */
+"AUTOTYPE_MESSAGE_UNLOCK_DATABASE" = "Please unlock the database to use Global Autotype";
+
/* Disable autotype menu item */
"AUTOTYPE_NO" = "Disable Autotype";