2
0

Improvements to layout, password types and preparations for security answers.

This commit is contained in:
Maarten Billemont 2016-04-23 11:54:07 -04:00
parent 35c443d82d
commit 15b14d67db
5 changed files with 565 additions and 388 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 8b6e3481d7963d08cd50fc5994702f2abdce3cc5 Subproject commit db613dce0a2a7ac83c866e9d0578038d45ec0c31

View File

@ -179,7 +179,7 @@ NSOperationQueue *_mpwQueue = nil;
return @"PIN"; return @"PIN";
case MPSiteTypeGeneratedName: case MPSiteTypeGeneratedName:
return @"Login Name"; return @"Name";
case MPSiteTypeGeneratedPhrase: case MPSiteTypeGeneratedPhrase:
return @"Phrase"; return @"Phrase";
@ -281,7 +281,7 @@ NSOperationQueue *_mpwQueue = nil;
- (NSArray *)allTypes { - (NSArray *)allTypes {
return [self allTypesStartingWith:MPSiteTypeGeneratedMaximum]; return [self allTypesStartingWith:MPSiteTypeGeneratedPhrase];
} }
- (NSArray *)allTypesStartingWith:(MPSiteType)startingType { - (NSArray *)allTypesStartingWith:(MPSiteType)startingType {
@ -298,6 +298,10 @@ NSOperationQueue *_mpwQueue = nil;
- (MPSiteType)nextType:(MPSiteType)type { - (MPSiteType)nextType:(MPSiteType)type {
switch (type) { switch (type) {
case MPSiteTypeGeneratedPhrase:
return MPSiteTypeGeneratedName;
case MPSiteTypeGeneratedName:
return MPSiteTypeGeneratedMaximum;
case MPSiteTypeGeneratedMaximum: case MPSiteTypeGeneratedMaximum:
return MPSiteTypeGeneratedLong; return MPSiteTypeGeneratedLong;
case MPSiteTypeGeneratedLong: case MPSiteTypeGeneratedLong:
@ -313,7 +317,7 @@ NSOperationQueue *_mpwQueue = nil;
case MPSiteTypeStoredPersonal: case MPSiteTypeStoredPersonal:
return MPSiteTypeStoredDevicePrivate; return MPSiteTypeStoredDevicePrivate;
case MPSiteTypeStoredDevicePrivate: case MPSiteTypeStoredDevicePrivate:
return MPSiteTypeGeneratedMaximum; return MPSiteTypeGeneratedPhrase;
default: default:
return MPSiteTypeGeneratedLong; return MPSiteTypeGeneratedLong;
} }

View File

@ -427,15 +427,14 @@
- (IBAction)changeType:(id)sender { - (IBAction)changeType:(id)sender {
MPSiteModel *site = self.selectedSite; MPSiteModel *site = self.selectedSite;
NSArray *types = [site.algorithm allTypesStartingWith:MPSiteTypeGeneratedPIN]; NSArray *types = [site.algorithm allTypes];
[self.passwordTypesMatrix renewRows:(NSInteger)[types count] columns:1]; [self.passwordTypesMatrix renewRows:(NSInteger)[types count] columns:1];
for (NSUInteger t = 0; t < [types count]; ++t) { for (NSUInteger t = 0; t < [types count]; ++t) {
MPSiteType type = (MPSiteType)[types[t] unsignedIntegerValue]; MPSiteType type = (MPSiteType)[types[t] unsignedIntegerValue];
NSString *title = [site.algorithm nameOfType:type]; NSString *title = [site.algorithm nameOfType:type];
if (type & MPSiteTypeClassGenerated) if (type & MPSiteTypeClassGenerated)
title = [site.algorithm generatePasswordForSiteNamed:site.name ofType:type title = strf( @"%@ %@", [site.algorithm generatePasswordForSiteNamed:site.name ofType:type withCounter:site.counter
withCounter:site.counter usingKey:[MPMacAppDelegate get].key], title );
usingKey:[MPMacAppDelegate get].key];
NSButtonCell *cell = [self.passwordTypesMatrix cellAtRow:(NSInteger)t column:0]; NSButtonCell *cell = [self.passwordTypesMatrix cellAtRow:(NSInteger)t column:0];
cell.tag = type; cell.tag = type;
@ -443,11 +442,12 @@
cell.title = title; cell.title = title;
} }
self.passwordTypesBox.title = strf( @"Choose a password type for %@:", site.name );
NSAlert *alert = [NSAlert new]; NSAlert *alert = [NSAlert new];
[alert addButtonWithTitle:@"Save"]; [alert addButtonWithTitle:@"Save"];
[alert addButtonWithTitle:@"Cancel"]; [alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Change Password Type"]; [alert setMessageText:@"Change Password Type"];
[alert setInformativeText:strf( @"Choose a new password type for: %@", site.name )];
[alert setAccessoryView:self.passwordTypesBox]; [alert setAccessoryView:self.passwordTypesBox];
[alert layout]; [alert layout];
[alert beginSheetModalForWindow:self.window modalDelegate:self [alert beginSheetModalForWindow:self.window modalDelegate:self

File diff suppressed because it is too large Load Diff

View File

@ -168,6 +168,15 @@
[self updateContent]; [self updateContent];
} }
- (void)setQuestion:(NSString *)question {
if ([question isEqualToString:_question])
return;
_question = question;
[self updateContent];
}
- (BOOL)outdated { - (BOOL)outdated {
return self.algorithmVersion < MPAlgorithmVersionCurrent; return self.algorithmVersion < MPAlgorithmVersionCurrent;