From 15b14d67db62ff34682ae9228356e25e238d3866 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sat, 23 Apr 2016 11:54:07 -0400 Subject: [PATCH] Improvements to layout, password types and preparations for security answers. --- External/Pearl | 2 +- MasterPassword/ObjC/MPAlgorithmV0.m | 10 +- .../ObjC/Mac/MPPasswordWindowController.m | 10 +- .../ObjC/Mac/MPPasswordWindowController.xib | 922 +++++++++++------- MasterPassword/ObjC/Mac/MPSiteModel.m | 9 + 5 files changed, 565 insertions(+), 388 deletions(-) diff --git a/External/Pearl b/External/Pearl index 8b6e3481..db613dce 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit 8b6e3481d7963d08cd50fc5994702f2abdce3cc5 +Subproject commit db613dce0a2a7ac83c866e9d0578038d45ec0c31 diff --git a/MasterPassword/ObjC/MPAlgorithmV0.m b/MasterPassword/ObjC/MPAlgorithmV0.m index 538f45aa..522ea598 100644 --- a/MasterPassword/ObjC/MPAlgorithmV0.m +++ b/MasterPassword/ObjC/MPAlgorithmV0.m @@ -179,7 +179,7 @@ NSOperationQueue *_mpwQueue = nil; return @"PIN"; case MPSiteTypeGeneratedName: - return @"Login Name"; + return @"Name"; case MPSiteTypeGeneratedPhrase: return @"Phrase"; @@ -281,7 +281,7 @@ NSOperationQueue *_mpwQueue = nil; - (NSArray *)allTypes { - return [self allTypesStartingWith:MPSiteTypeGeneratedMaximum]; + return [self allTypesStartingWith:MPSiteTypeGeneratedPhrase]; } - (NSArray *)allTypesStartingWith:(MPSiteType)startingType { @@ -298,6 +298,10 @@ NSOperationQueue *_mpwQueue = nil; - (MPSiteType)nextType:(MPSiteType)type { switch (type) { + case MPSiteTypeGeneratedPhrase: + return MPSiteTypeGeneratedName; + case MPSiteTypeGeneratedName: + return MPSiteTypeGeneratedMaximum; case MPSiteTypeGeneratedMaximum: return MPSiteTypeGeneratedLong; case MPSiteTypeGeneratedLong: @@ -313,7 +317,7 @@ NSOperationQueue *_mpwQueue = nil; case MPSiteTypeStoredPersonal: return MPSiteTypeStoredDevicePrivate; case MPSiteTypeStoredDevicePrivate: - return MPSiteTypeGeneratedMaximum; + return MPSiteTypeGeneratedPhrase; default: return MPSiteTypeGeneratedLong; } diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m index 4d0f8551..cf469915 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m @@ -427,15 +427,14 @@ - (IBAction)changeType:(id)sender { MPSiteModel *site = self.selectedSite; - NSArray *types = [site.algorithm allTypesStartingWith:MPSiteTypeGeneratedPIN]; + NSArray *types = [site.algorithm allTypes]; [self.passwordTypesMatrix renewRows:(NSInteger)[types count] columns:1]; for (NSUInteger t = 0; t < [types count]; ++t) { MPSiteType type = (MPSiteType)[types[t] unsignedIntegerValue]; NSString *title = [site.algorithm nameOfType:type]; if (type & MPSiteTypeClassGenerated) - title = [site.algorithm generatePasswordForSiteNamed:site.name ofType:type - withCounter:site.counter - usingKey:[MPMacAppDelegate get].key]; + title = strf( @"%@ – %@", [site.algorithm generatePasswordForSiteNamed:site.name ofType:type withCounter:site.counter + usingKey:[MPMacAppDelegate get].key], title ); NSButtonCell *cell = [self.passwordTypesMatrix cellAtRow:(NSInteger)t column:0]; cell.tag = type; @@ -443,11 +442,12 @@ cell.title = title; } + self.passwordTypesBox.title = strf( @"Choose a password type for %@:", site.name ); + NSAlert *alert = [NSAlert new]; [alert addButtonWithTitle:@"Save"]; [alert addButtonWithTitle:@"Cancel"]; [alert setMessageText:@"Change Password Type"]; - [alert setInformativeText:strf( @"Choose a new password type for: %@", site.name )]; [alert setAccessoryView:self.passwordTypesBox]; [alert layout]; [alert beginSheetModalForWindow:self.window modalDelegate:self diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib index 1d88311c..d632cae7 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.xib @@ -42,13 +42,13 @@ - - + + - + @@ -118,12 +118,7 @@ - - - NSNegateBoolean - - - + @@ -132,31 +127,31 @@ NSNegateBoolean + + + NSNegateBoolean + + - - - - + + - - + + - - - + - + + + + + + - + - - - + + - - - + + + - - + - - - - + - - - - - @@ -1048,17 +1210,17 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit. - - + + - + - + - + @@ -1066,27 +1228,27 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit. - + - + - + - + - + - + @@ -1102,7 +1264,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit. - + "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. @@ -1114,15 +1276,17 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit. - + - - - + + + + + diff --git a/MasterPassword/ObjC/Mac/MPSiteModel.m b/MasterPassword/ObjC/Mac/MPSiteModel.m index 54eb5f8c..208fdec9 100644 --- a/MasterPassword/ObjC/Mac/MPSiteModel.m +++ b/MasterPassword/ObjC/Mac/MPSiteModel.m @@ -168,6 +168,15 @@ [self updateContent]; } +- (void)setQuestion:(NSString *)question { + + if ([question isEqualToString:_question]) + return; + _question = question; + + [self updateContent]; +} + - (BOOL)outdated { return self.algorithmVersion < MPAlgorithmVersionCurrent;