diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index d72e0862..3772b7cd 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -5,7 +5,6 @@
-
diff --git a/MasterPassword/ObjC/MPEntities.h b/MasterPassword/ObjC/MPEntities.h
index edd2c375..c2368667 100644
--- a/MasterPassword/ObjC/MPEntities.h
+++ b/MasterPassword/ObjC/MPEntities.h
@@ -22,6 +22,13 @@
@end
+@interface MPSiteQuestionEntity(MP)
+
+- (NSString *)resolveQuestionAnswerUsingKey:(MPKey *)key;
+- (void)resolveQuestionAnswerUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
+
+@end
+
@interface MPSiteEntity(MP)
@property(assign) BOOL loginGenerated;
@@ -38,8 +45,10 @@
- (BOOL)tryMigrateExplicitly:(BOOL)explicit;
- (NSString *)resolveLoginUsingKey:(MPKey *)key;
- (NSString *)resolvePasswordUsingKey:(MPKey *)key;
+- (NSString *)resolveSiteAnswerUsingKey:(MPKey *)key;
- (void)resolveLoginUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
- (void)resolvePasswordUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
+- (void)resolveSiteAnswerUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
@end
diff --git a/MasterPassword/ObjC/MPEntities.m b/MasterPassword/ObjC/MPEntities.m
index f2b57da2..5ae3259d 100644
--- a/MasterPassword/ObjC/MPEntities.m
+++ b/MasterPassword/ObjC/MPEntities.m
@@ -35,6 +35,20 @@
@end
+@implementation MPSiteQuestionEntity(MP)
+
+- (NSString *)resolveQuestionAnswerUsingKey:(MPKey *)key {
+
+ return [self.site.algorithm resolveAnswerForQuestion:self usingKey:key];
+}
+
+- (void)resolveQuestionAnswerUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result {
+
+ [self.site.algorithm resolveAnswerForQuestion:self usingKey:key result:result];
+}
+
+@end
+
@implementation MPSiteEntity(MP)
- (MPFixableResult)findAndFixInconsistenciesInContext:(NSManagedObjectContext *)context {
@@ -175,6 +189,11 @@
return [self.algorithm resolvePasswordForSite:self usingKey:key];
}
+- (NSString *)resolveSiteAnswerUsingKey:(MPKey *)key {
+
+ return [self.algorithm resolveAnswerForSite:self usingKey:key];
+}
+
- (void)resolveLoginUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result {
[self.algorithm resolveLoginForSite:self usingKey:key result:result];
@@ -185,6 +204,11 @@
[self.algorithm resolvePasswordForSite:self usingKey:key result:result];
}
+- (void)resolveSiteAnswerUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result {
+
+ [self.algorithm resolveAnswerForSite:self usingKey:key result:result];
+}
+
@end
@implementation MPGeneratedSiteEntity(MP)
diff --git a/MasterPassword/ObjC/Mac/MPInitialWindow.xib b/MasterPassword/ObjC/Mac/MPInitialWindow.xib
index 54d9f470..d3a0b46c 100644
--- a/MasterPassword/ObjC/Mac/MPInitialWindow.xib
+++ b/MasterPassword/ObjC/Mac/MPInitialWindow.xib
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.h b/MasterPassword/ObjC/Mac/MPPasswordWindowController.h
index 90e94019..29613088 100644
--- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.h
+++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.h
@@ -28,6 +28,7 @@
@property(nonatomic) NSString *masterPassword;
@property(nonatomic) BOOL showVersionContainer;
@property(nonatomic) BOOL alternatePressed;
+@property(nonatomic) BOOL shiftPressed;
@property(nonatomic) BOOL locked;
@property(nonatomic) BOOL newUser;
diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m
index 37dd0c82..e6d9410d 100644
--- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m
+++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m
@@ -124,6 +124,10 @@
- (void)flagsChanged:(NSEvent *)theEvent {
+ BOOL shiftPressed = (theEvent.modifierFlags & NSShiftKeyMask) != 0;
+ if (shiftPressed != self.shiftPressed)
+ self.shiftPressed = shiftPressed;
+
BOOL alternatePressed = (theEvent.modifierFlags & NSAlternateKeyMask) != 0;
if (alternatePressed != self.alternatePressed) {
self.alternatePressed = alternatePressed;
@@ -486,7 +490,7 @@
}
// Performing action while content is available. Copy it.
- [self copyContent:selectedSite.content];
+ [self copyContent:self.shiftPressed? selectedSite.answer: selectedSite.content];
[self fadeOut];
diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib
index 857e5018..5881bcc3 100644
--- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib
+++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -28,10 +28,10 @@
-
+
-
+
@@ -55,19 +55,16 @@
-
-
-
+
-
@@ -101,7 +97,6 @@
-
@@ -137,7 +132,6 @@
-
@@ -173,7 +167,6 @@
@@ -1014,7 +1033,6 @@
-
@@ -1024,16 +1042,15 @@
-
+
-
+
-
@@ -1078,9 +1095,8 @@
-
+
-
"Personal password" allows you to store your own password. It cannot be regenerated in the event of loss. "Device private password" is similar but will never leave your device: it cannot be synced, backed up or exported.
@@ -1089,7 +1105,6 @@
-
@@ -1100,13 +1115,12 @@
-
+
-
diff --git a/MasterPassword/ObjC/Mac/MPSiteModel.h b/MasterPassword/ObjC/Mac/MPSiteModel.h
index 01e30cf9..9192e5dd 100644
--- a/MasterPassword/ObjC/Mac/MPSiteModel.h
+++ b/MasterPassword/ObjC/Mac/MPSiteModel.h
@@ -31,6 +31,8 @@
@property (nonatomic) NSString *typeName;
@property (nonatomic) NSString *content;
@property (nonatomic) NSString *displayedContent;
+@property (nonatomic) NSString *question;
+@property (nonatomic) NSString *answer;
@property (nonatomic) NSString *loginName;
@property (nonatomic) NSNumber *uses;
@property (nonatomic) NSUInteger counter;
diff --git a/MasterPassword/ObjC/Mac/MPSiteModel.m b/MasterPassword/ObjC/Mac/MPSiteModel.m
index 9e1a700e..54eb5f8c 100644
--- a/MasterPassword/ObjC/Mac/MPSiteModel.m
+++ b/MasterPassword/ObjC/Mac/MPSiteModel.m
@@ -194,13 +194,18 @@
[MPMacAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
[self updateContent:[MPSiteEntity existingObjectWithID:_entityOID inContext:context]];
}];
+
else
PearlNotMainQueue( ^{
- NSString *password = [self.algorithm generatePasswordForSiteNamed:self.name ofType:self.type withCounter:self.counter
- usingKey:[MPAppDelegate_Shared get].key];
- NSString *loginName = [self.algorithm generateLoginForSiteNamed:self.name usingKey:[MPAppDelegate_Shared get].key];
- [self updatePasswordWithResult:password];
- [self updateLoginNameWithResult:loginName];
+ [self updatePasswordWithResult:
+ [self.algorithm generatePasswordForSiteNamed:self.name ofType:self.type withCounter:self.counter
+ usingKey:[MPAppDelegate_Shared get].key]];
+ [self updateLoginNameWithResult:
+ [self.algorithm generateLoginForSiteNamed:self.name
+ usingKey:[MPAppDelegate_Shared get].key]];
+ [self updateAnswerWithResult:
+ [self.algorithm generateAnswerForSiteNamed:self.name onQuestion:self.question
+ usingKey:[MPAppDelegate_Shared get].key]];
} );
}
@@ -212,6 +217,9 @@
[entity resolveLoginUsingKey:[MPAppDelegate_Shared get].key result:^(NSString *result) {
[self updateLoginNameWithResult:result];
}];
+ [entity resolveSiteAnswerUsingKey:[MPAppDelegate_Shared get].key result:^(NSString *result) {
+ [self updateAnswerWithResult:result];
+ }];
}
- (void)updatePasswordWithResult:(NSString *)result {
@@ -239,4 +247,11 @@
} );
}
+- (void)updateAnswerWithResult:(NSString *)answer {
+
+ PearlMainQueue( ^{
+ self.answer = answer;
+ } );
+}
+
@end
diff --git a/MasterPassword/ObjC/iOS/MPAnswersViewController.m b/MasterPassword/ObjC/iOS/MPAnswersViewController.m
index 8c677987..06a77682 100644
--- a/MasterPassword/ObjC/iOS/MPAnswersViewController.m
+++ b/MasterPassword/ObjC/iOS/MPAnswersViewController.m
@@ -178,7 +178,7 @@
else if ([cell isKindOfClass:[MPSendAnswersCell class]]) {
NSString *body;
if (!_multiple) {
- NSObject *answer = [site.algorithm resolveAnswerForSite:site usingKey:[MPiOSAppDelegate get].key];
+ NSObject *answer = [site resolveSiteAnswerUsingKey:[MPiOSAppDelegate get].key];
body = strf( @"Master Password generated the following security answer for your site: %@\n\n"
@"%@\n"
@"\n\nYou should use this as the answer to each security question the site asks you.\n"
@@ -188,7 +188,7 @@
NSMutableString *bodyBuilder = [NSMutableString string];
[bodyBuilder appendFormat:@"Master Password generated the following security answers for your site: %@\n\n", site.name];
for (MPSiteQuestionEntity *question in site.questions) {
- NSObject *answer = [site.algorithm resolveAnswerForQuestion:question usingKey:[MPiOSAppDelegate get].key];
+ NSObject *answer = [question resolveQuestionAnswerUsingKey:[MPiOSAppDelegate get].key];
[bodyBuilder appendFormat:@"For question: '%@', use answer: %@\n", question.keyword, answer];
}
[bodyBuilder appendFormat:@"\n\nUse the answer for the matching security question.\n"
@@ -241,7 +241,7 @@
self.titleLabel.text = strl( @"Answer for %@:", site.name );
self.answerField.text = @"...";
- [site.algorithm resolveAnswerForSite:site usingKey:[MPiOSAppDelegate get].key result:^(NSString *result) {
+ [site resolveSiteAnswerUsingKey:[MPiOSAppDelegate get].key result:^(NSString *result) {
PearlMainQueue( ^{
self.answerField.text = result;
} );
@@ -330,7 +330,7 @@
PearlMainQueue( ^{
self.answerField.text = @"...";
} );
- [site.algorithm resolveAnswerForQuestion:question usingKey:[MPiOSAppDelegate get].key result:^(NSString *result) {
+ [question resolveQuestionAnswerUsingKey:[MPiOSAppDelegate get].key result:^(NSString *result) {
PearlMainQueue( ^{
self.questionField.text = keyword;
self.answerField.text = result;