mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 22:52:26 +00:00
Merged Advanced and Templates of database settings into on - Advanced
Added encryption rounds benchmark and setting to security tab (non-functional setter, benchmark works)
This commit is contained in:
Submodule KeePassKit updated: 05b59b464e...da5e32a452
@@ -38,6 +38,7 @@
|
||||
4C19E500178E26EF002F2CD0 /* Test_Password_1234.kdbx in Resources */ = {isa = PBXBuildFile; fileRef = 4C19E4FF178E26EF002F2CD0 /* Test_Password_1234.kdbx */; };
|
||||
4C19E503178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */; };
|
||||
4C1DDCDD1711ECEB00C98DA3 /* PasswordCreatorWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */; };
|
||||
4C224B4217DFCB2400FF6AEE /* MPNumericalInputFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */; };
|
||||
4C245B76176E1E3D0086100E /* DDData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C245A6A176E1E3C0086100E /* DDData.m */; };
|
||||
4C245B77176E1E3D0086100E /* DDNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C245A6C176E1E3C0086100E /* DDNumber.m */; };
|
||||
4C245B78176E1E3D0086100E /* DDRange.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C245A6E176E1E3C0086100E /* DDRange.m */; };
|
||||
@@ -328,6 +329,8 @@
|
||||
4C19E501178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDatabasePasswordAndKeyfile.h; sourceTree = "<group>"; };
|
||||
4C19E502178E2871002F2CD0 /* MPDatabasePasswordAndKeyfile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDatabasePasswordAndKeyfile.m; sourceTree = "<group>"; };
|
||||
4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordCreatorWindow.xib; sourceTree = "<group>"; };
|
||||
4C224B4017DFCB2300FF6AEE /* MPNumericalInputFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNumericalInputFormatter.h; sourceTree = "<group>"; };
|
||||
4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNumericalInputFormatter.m; sourceTree = "<group>"; };
|
||||
4C245A69176E1E3C0086100E /* DDData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDData.h; sourceTree = "<group>"; };
|
||||
4C245A6A176E1E3C0086100E /* DDData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDData.m; sourceTree = "<group>"; };
|
||||
4C245A6B176E1E3C0086100E /* DDNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDNumber.h; sourceTree = "<group>"; };
|
||||
@@ -1046,6 +1049,8 @@
|
||||
4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */,
|
||||
4C4B7EF617A4B335000234C7 /* MPUniqueCharactersFormatter.h */,
|
||||
4C4B7EF717A4B335000234C7 /* MPUniqueCharactersFormatter.m */,
|
||||
4C224B4017DFCB2300FF6AEE /* MPNumericalInputFormatter.h */,
|
||||
4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */,
|
||||
);
|
||||
name = Helper;
|
||||
sourceTree = "<group>";
|
||||
@@ -1999,6 +2004,7 @@
|
||||
4CC6DB7D17D23DCE002C6091 /* KPKUTIs.m in Sources */,
|
||||
4CEED1C617D7BD0E007180F1 /* NSError+Messages.m in Sources */,
|
||||
4C00E33817D8FA3500F37192 /* DDHotKeyCenter.m in Sources */,
|
||||
4C224B4217DFCB2400FF6AEE /* MPNumericalInputFormatter.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "-NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints YES"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<AdditionalOptions>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,8 @@
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
|
||||
MPDatabaseSettingsTabGeneral,
|
||||
MPDatabaseSettingsTabDisplay,
|
||||
MPDatabaseSettingsTabAdvanced,
|
||||
MPDatabaseSettingsTabTemplates,
|
||||
MPDatabaseSettingsTabSecurity,
|
||||
MPDatabaseSettingsTabAdvanced
|
||||
};
|
||||
|
||||
@class MPDocument;
|
||||
@@ -27,21 +26,20 @@ typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
|
||||
@property (weak) IBOutlet NSTextField *databaseNameTextField;
|
||||
@property (unsafe_unretained) IBOutlet NSTextView *databaseDescriptionTextView;
|
||||
|
||||
/* Display Tab */
|
||||
/* Security Tab */
|
||||
@property (weak) IBOutlet NSButton *protectTitleCheckButton;
|
||||
@property (weak) IBOutlet NSButton *protectUserNameCheckButton;
|
||||
@property (weak) IBOutlet NSButton *protectPasswortCheckButton;
|
||||
@property (weak) IBOutlet NSButton *protectURLCheckButton;
|
||||
@property (weak) IBOutlet NSButton *protectNotesCheckButton;
|
||||
@property (weak) IBOutlet NSTextField *encryptionRoundsTextField;
|
||||
@property (weak) IBOutlet NSButton *benchmarkButton;
|
||||
|
||||
/* Advanced Tab*/
|
||||
@property (weak) IBOutlet NSButton *enableRecycleBinCheckButton;
|
||||
@property (weak) IBOutlet NSButton *emptyRecycleBinOnQuitCheckButton;
|
||||
@property (weak) IBOutlet NSPopUpButton *selectRecycleBinGroupPopUpButton;
|
||||
|
||||
|
||||
/* Templates Tab */
|
||||
@property (weak) IBOutlet HNHRoundedTextField *defaultUsernameTextField;
|
||||
@property (weak) IBOutlet NSTextField *defaultUsernameTextField;
|
||||
@property (weak) IBOutlet NSPopUpButton *templateGroupPopUpButton;
|
||||
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#import "MPDatabaseVersion.h"
|
||||
#import "MPIconHelper.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "MPNumericalInputFormatter.h"
|
||||
|
||||
#import "KPKGroup.h"
|
||||
#import "KPKTree.h"
|
||||
#import "KPKMetaData.h"
|
||||
#import "KPKNode+IconImage.h"
|
||||
#import "KPKPassword.h"
|
||||
|
||||
#import "HNHRoundedTextField.h"
|
||||
#import "HNHRoundedSecureTextField.h"
|
||||
@@ -54,8 +56,11 @@
|
||||
NSAssert(_document != nil, @"Document needs to be present");
|
||||
|
||||
[self.sectionTabView setDelegate:self];
|
||||
[self.encryptionRoundsTextField setFormatter:[[MPNumericalInputFormatter alloc] init]];
|
||||
}
|
||||
|
||||
#pragma mark Actions
|
||||
|
||||
- (IBAction)save:(id)sender {
|
||||
/* General */
|
||||
KPKMetaData *metaData = _document.tree.metaData;
|
||||
@@ -86,7 +91,7 @@
|
||||
metaData.protectUrl = protectURL;
|
||||
metaData.protectUserName = protectUsername;
|
||||
metaData.defaultUserName = [self.defaultUsernameTextField stringValue];
|
||||
|
||||
|
||||
/*
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setBool:protectNotes forKey:kMPSettingsKeyLegacyHideNotes];
|
||||
@@ -103,6 +108,14 @@
|
||||
[self dismissSheet:0];
|
||||
}
|
||||
|
||||
- (IBAction)benchmarkRounds:(id)sender {
|
||||
[self.benchmarkButton setEnabled:NO];
|
||||
[KPKPassword benchmarkTransformationRounds:1 completionHandler:^(NSUInteger rounds) {
|
||||
[self.encryptionRoundsTextField setIntegerValue:rounds];
|
||||
[self.benchmarkButton setEnabled:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateView {
|
||||
if(!self.isDirty) {
|
||||
return;
|
||||
@@ -112,7 +125,6 @@
|
||||
[self _setupDatabase:metaData];
|
||||
[self _setupProtectionTab:metaData];
|
||||
[self _setupAdvancedTab:_document.tree];
|
||||
[self _setupTemplatesTab:_document.tree];
|
||||
self.isDirty = NO;
|
||||
}
|
||||
|
||||
@@ -124,11 +136,6 @@
|
||||
if(![self window]) {
|
||||
return;
|
||||
}
|
||||
NSTabViewItem *tabViewItem = [self.sectionTabView tabViewItemAtIndex:tab];
|
||||
BOOL canSelectTab = [self tabView:self.sectionTabView shouldSelectTabViewItem:tabViewItem];
|
||||
if(!canSelectTab) {
|
||||
[self.sectionTabView selectTabViewItemAtIndex:MPDatabaseSettingsTabTemplates];
|
||||
}
|
||||
[self.sectionTabView selectTabViewItemAtIndex:tab];
|
||||
}
|
||||
|
||||
@@ -136,14 +143,10 @@
|
||||
- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem {
|
||||
NSUInteger index = [tabView indexOfTabViewItem:tabViewItem];
|
||||
switch ((MPDatabaseSettingsTab)index) {
|
||||
case MPDatabaseSettingsTabDisplay:
|
||||
return YES;
|
||||
|
||||
case MPDatabaseSettingsTabSecurity:
|
||||
case MPDatabaseSettingsTabAdvanced:
|
||||
case MPDatabaseSettingsTabGeneral:
|
||||
case MPDatabaseSettingsTabTemplates:
|
||||
return YES;
|
||||
//return (_document.version == MPDatabaseVersion4);
|
||||
|
||||
default:
|
||||
return NO;
|
||||
@@ -162,15 +165,15 @@
|
||||
[self.protectTitleCheckButton setState:metaData.protectTitle ? NSOnState : NSOffState];
|
||||
[self.protectURLCheckButton setState:metaData.protectUrl ? NSOnState : NSOffState];
|
||||
[self.protectUserNameCheckButton setState:metaData.protectUserName ? NSOnState : NSOffState];
|
||||
[self.encryptionRoundsTextField setIntegerValue:metaData.rounds];
|
||||
[self.benchmarkButton setEnabled:YES];
|
||||
}
|
||||
|
||||
- (void)_setupAdvancedTab:(KPKTree *)tree {
|
||||
[self.enableRecycleBinCheckButton bind:NSValueBinding toObject:self withKeyPath:@"trashEnabled" options:nil];
|
||||
[self.selectRecycleBinGroupPopUpButton bind:NSEnabledBinding toObject:self withKeyPath:@"trashEnabled" options:nil];
|
||||
[self _updateTrashFolders:tree];
|
||||
}
|
||||
|
||||
- (void)_setupTemplatesTab:(KPKTree *)tree {
|
||||
|
||||
[self.defaultUsernameTextField setStringValue:tree.metaData.defaultUserName];
|
||||
[self.defaultUsernameTextField setEditable:YES];
|
||||
[self _updateTemplateGroup:tree];
|
||||
@@ -182,19 +185,16 @@
|
||||
|
||||
switch(tab) {
|
||||
case MPDatabaseSettingsTabAdvanced:
|
||||
[[self window] makeFirstResponder:self.databaseNameTextField];
|
||||
[[self window] makeFirstResponder:self.defaultUsernameTextField];
|
||||
break;
|
||||
|
||||
case MPDatabaseSettingsTabDisplay:
|
||||
case MPDatabaseSettingsTabSecurity:
|
||||
[[self window] makeFirstResponder:self.protectTitleCheckButton];
|
||||
break;
|
||||
|
||||
case MPDatabaseSettingsTabGeneral:
|
||||
[[self window] makeFirstResponder:self.databaseNameTextField];
|
||||
break;
|
||||
|
||||
case MPDatabaseSettingsTabTemplates:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ typedef NS_ENUM(NSUInteger, MPAlertContext) {
|
||||
}
|
||||
|
||||
- (void)editTemplateGroup:(id)sender {
|
||||
[self _showDatabaseSetting:MPDatabaseSettingsTabTemplates];
|
||||
[self _showDatabaseSetting:MPDatabaseSettingsTabAdvanced];
|
||||
}
|
||||
|
||||
- (void)editTrashGroup:(id)sender {
|
||||
|
||||
13
MacPass/MPNumericalInputFormatter.h
Normal file
13
MacPass/MPNumericalInputFormatter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// MPNumericalInputFormatter.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 10.09.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MPNumericalInputFormatter : NSFormatter
|
||||
|
||||
@end
|
||||
46
MacPass/MPNumericalInputFormatter.m
Normal file
46
MacPass/MPNumericalInputFormatter.m
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// MPNumericalInputFormatter.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 10.09.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPNumericalInputFormatter.h"
|
||||
|
||||
@implementation MPNumericalInputFormatter
|
||||
|
||||
static NSCharacterSet *_characterSet = nil;
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_characterSet = [[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)obj {
|
||||
if([obj isKindOfClass:[NSNumber class]]) {
|
||||
return [[NSString alloc] initWithFormat:@"%ld",[obj integerValue]];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error {
|
||||
NSNumber *number = [[NSNumber alloc] initWithInteger:[string integerValue]];
|
||||
*obj = number;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr
|
||||
proposedSelectedRange:(NSRangePointer)proposedSelRangePtr
|
||||
originalString:(NSString *)origString
|
||||
originalSelectedRange:(NSRange)origSelRange
|
||||
errorDescription:(NSString **)error {
|
||||
NSRange range = [*partialStringPtr rangeOfCharacterFromSet:_characterSet];
|
||||
return (range.location == NSNotFound);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -151,7 +151,7 @@
|
||||
<string key="NSFrame">{{90, 60}, {200, 19}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="939116773"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="1067181375">
|
||||
@@ -350,6 +350,7 @@
|
||||
<string key="NSFrame">{{184, 13}, {151, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="767191408">
|
||||
@@ -399,7 +400,7 @@
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="1060378975"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
@@ -1361,11 +1362,6 @@
|
||||
<reference key="object" ref="819722880"/>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">76</int>
|
||||
<reference key="object" ref="200690376"/>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">77</int>
|
||||
<reference key="object" ref="452811316"/>
|
||||
@@ -1376,6 +1372,11 @@
|
||||
<reference key="object" ref="819324786"/>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">76</int>
|
||||
<reference key="object" ref="200690376"/>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
@@ -1502,7 +1503,7 @@
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">85</int>
|
||||
<int key="maxID">98</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -1529,16 +1530,10 @@
|
||||
<string key="className">MPPasswordEditWindowController</string>
|
||||
<string key="superclassName">MPSheetWindowController</string>
|
||||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="cancel:">id</string>
|
||||
<string key="clearKey:">id</string>
|
||||
<string key="generateKey:">id</string>
|
||||
<string key="save:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
<object class="IBActionInfo" key="cancel:">
|
||||
<string key="name">cancel:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="clearKey:">
|
||||
<string key="name">clearKey:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
@@ -1547,10 +1542,6 @@
|
||||
<string key="name">generateKey:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="save:">
|
||||
<string key="name">save:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="changePasswordButton">NSButton</string>
|
||||
|
||||
Reference in New Issue
Block a user