From f125e2fb41be12cca4c9e310774cbc3fcc74ea4f Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Sun, 29 Dec 2013 23:04:00 -0700 Subject: [PATCH 1/7] Added minor code to test that the database was decrypted successfully. The cryptorStatus != kCCSuccess conditional never seems to be triggered after testing with several bad passwords. --- KeePassKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeePassKit b/KeePassKit index dd4bb1d7..24cb9124 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit dd4bb1d77ebb34c047aa0f1bb5e874b301b874ea +Subproject commit 24cb912488d23599a325b3842feb71f8ca77fd4a From 35400ec2eb4672d4508675d6ecccd1e5b93e06e6 Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Sun, 29 Dec 2013 23:05:12 -0700 Subject: [PATCH 2/7] Disabled code signing so that the project can be built and run. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is for my own purposes because I don’t have an Apple Developer subscription. --- MacPass.xcodeproj/project.pbxproj | 10 +++++----- MacPass/WelcomeWindow.xib | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 9442951f..68c82b74 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -475,9 +475,9 @@ 4C52A88C1788628B00868229 /* 13_KeysTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 13_KeysTemplate.pdf; sourceTree = ""; }; 4C52A88D1788628B00868229 /* 18_DisplayTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 18_DisplayTemplate.pdf; sourceTree = ""; }; 4C52A891178863B000868229 /* 68_PhoneTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 68_PhoneTemplate.pdf; sourceTree = ""; }; - 4C53A7A81864C3A1000DFF0D /* de */ = {isa = PBXFileReference; lastKnownFileType = file; name = de; path = de.lproj/KPKLocalizeable.strings; sourceTree = ""; }; - 4C53A7A91864C3A2000DFF0D /* en */ = {isa = PBXFileReference; lastKnownFileType = file; name = en; path = en.lproj/KPKLocalizeable.strings; sourceTree = ""; }; - 4C53A7AA1864C3A2000DFF0D /* fr */ = {isa = PBXFileReference; lastKnownFileType = file; name = fr; path = fr.lproj/KPKLocalizeable.strings; sourceTree = ""; }; + 4C53A7A81864C3A1000DFF0D /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/KPKLocalizeable.strings; sourceTree = ""; }; + 4C53A7A91864C3A2000DFF0D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/KPKLocalizeable.strings; sourceTree = ""; }; + 4C53A7AA1864C3A2000DFF0D /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/KPKLocalizeable.strings; sourceTree = ""; }; 4C5426F217BEEA8700A4424C /* Autotype_test.kdbx */ = {isa = PBXFileReference; lastKnownFileType = file; name = Autotype_test.kdbx; path = Databases/Autotype_test.kdbx; sourceTree = ""; }; 4C569D9C17652AC800595B62 /* MPConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPConstants.h; sourceTree = ""; }; 4C569D9D17652B0600595B62 /* MPConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPConstants.m; sourceTree = ""; }; @@ -2306,7 +2306,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch"; @@ -2322,7 +2322,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MacPass/MacPass-Prefix.pch"; diff --git a/MacPass/WelcomeWindow.xib b/MacPass/WelcomeWindow.xib index 09a85087..1d37b32b 100644 --- a/MacPass/WelcomeWindow.xib +++ b/MacPass/WelcomeWindow.xib @@ -1,5 +1,5 @@ - + @@ -15,7 +15,7 @@ - + From 1bb753173aa6a7e7a17dd755640b6acec5d3b63a Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Tue, 31 Dec 2013 22:01:26 -0700 Subject: [PATCH 3/7] Fixed issue with blank outline and entry views if the inspector was hidden before unlocking the database. --- MacPass/MPDocumentWindowController.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 4460421b..85ed99a5 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -354,18 +354,18 @@ typedef NS_ENUM(NSUInteger, MPAlertContext) { options:0 metrics:nil views:views]]; - /* Restore the State the inspector view was in before the view change */ - if(removeInspector) { - [inspectorView removeFromSuperview]; - } - [contentView layoutSubtreeIfNeeded]; - [_entryViewController updateResponderChain]; [_inspectorViewController updateResponderChain]; [_outlineViewController updateResponderChain]; /* Custom setup after being added to window */ [_inspectorViewController prepareView]; [_outlineViewController showOutline]; + + /* Restore the State the inspector view was in before the view change */ + if(removeInspector) { + [inspectorView removeFromSuperview]; + } + [contentView layoutSubtreeIfNeeded]; } #pragma mark Validation From ce838f6b7a3e48ffadf1e0a6633e3bf3b0a27dcf Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Wed, 1 Jan 2014 18:03:25 -0700 Subject: [PATCH 4/7] Implemented context menu validation. --- MacPass/MPEntryViewController.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 89f6db35..afc15647 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -469,6 +469,23 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell"; if(![document validateMenuItem:menuItem]) { return NO; } + + // CS: don't know how to iterate through KPKEntry properties to check for blanks so just check the declared properties + KPKEntry *targetEntry = [self _clickedOrSelectedEntry]; + MPActionType actionType = [MPActionHelper typeForAction:[menuItem action]]; + + if (([[targetEntry username] length] == 0) && (actionType == MPActionCopyUsername)) { + return NO; + } + + if (([[targetEntry password] length] == 0) && (actionType == MPActionCopyPassword)) { + return NO; + } + + if (([[targetEntry url] length] == 0) && (actionType == MPActionCopyURL || actionType == MPActionOpenURL)) { + return NO; + } + return YES; /* TODO handle _clickedOrSlectedEnty */ } From da93396ee753e41703ee615f32e18ad5cfffaaee Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Wed, 1 Jan 2014 19:10:03 -0700 Subject: [PATCH 5/7] Implemented Edit button; it must be clicked to modify an entry. --- MacPass/Base.lproj/InspectorView.xib | 33 ++++++++++++++++-------- MacPass/MPEntryInspectorViewController.h | 3 ++- MacPass/MPEntryInspectorViewController.m | 33 ++++++++++++++++++++++++ MacPass/MPInspectorViewController.h | 1 + MacPass/MPInspectorViewController.m | 26 +++++++++++++++++++ 5 files changed, 84 insertions(+), 12 deletions(-) diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index 43602a55..d4fc2b15 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -2,10 +2,10 @@ 1080 - 13A603 + 13B42 4514 1265 - 695.00 + 696.00 com.apple.InterfaceBuilder.CocoaPlugin 4514 @@ -328,6 +328,14 @@ 3122 + + + handleEditButtonClickEvent: + + + + 3125 + @@ -988,7 +996,7 @@ - 3123 + 3125 @@ -1003,17 +1011,20 @@ MPInspectorViewController MPViewController - - showImagePopup: - id - - - showImagePopup: - + + id + id + + + + handleEditButtonClickEvent: + id + + showImagePopup: id - + HNHGradientView NSTextField diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index 77f41f2d..8e827b58 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -44,6 +44,7 @@ - (IBAction)addCustomField:(id)sender; - (IBAction)removeCustomField:(id)sender; - +- (void)beginEditing; +- (void)endEditing; @end diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 9f364fbc..94941439 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -184,6 +184,39 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.entry removeBinary:binary]; } +// CS: could there be a better way? +- (void)beginEditing +{ + NSLog(@"beganEditing:"); + + _titleTextField.editable = YES; + _usernameTextField.editable = YES; + _URLTextField.editable = YES; + _passwordTextField.editable = YES; + + _createdTextField.editable = YES; + _modifiedTextField.editable = YES; + + _notesTextView.editable = YES; + +} + +// CS: could there be a better way? +- (void)endEditing +{ + NSLog(@"endEditing"); + _titleTextField.editable = NO; + _usernameTextField.editable = NO; + _URLTextField.editable = NO; + _passwordTextField.editable = NO; + + _createdTextField.editable = NO; + _modifiedTextField.editable = NO; + + _notesTextView.editable = NO; +} + + #pragma mark - #pragma mark Popovers diff --git a/MacPass/MPInspectorViewController.h b/MacPass/MPInspectorViewController.h index c447829b..668ed392 100644 --- a/MacPass/MPInspectorViewController.h +++ b/MacPass/MPInspectorViewController.h @@ -22,6 +22,7 @@ @property (weak) IBOutlet NSButton *editButton; - (IBAction)showImagePopup:(id)sender; +- (IBAction)handleEditButtonClickEvent:(id)sender; /* Seperate call to ensure alle registered objects are in place */ - (void)setupNotifications:(NSWindowController *)windowController; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index 9e50fcc9..c1e89498 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -156,6 +156,28 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } +#pragma mark - +#pragma mark Click Edit Button + +// button title can be used as a status indicator +- (IBAction)handleEditButtonClickEvent:(id)sender +{ + NSString *buttonTitle; + + buttonTitle = self.editButton.title; + + if ([buttonTitle isEqualToString:@"Edit"]) { + NSLog(@"begin editing"); + [_entryViewController beginEditing]; + self.editButton.title = @"Done"; + } + else if ([buttonTitle isEqualToString:@"Done"]) { + NSLog(@"finished editing"); + [_entryViewController endEditing]; + self.editButton.title = @"Edit"; + } +} + #pragma mark - #pragma mark Popup - (IBAction)showImagePopup:(id)sender { @@ -246,5 +268,9 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } } [self _updateItemBindings:document.selectedItem]; + + // disable the entry text fields whenever the entry selection changes + [_entryViewController endEditing]; + self.editButton.title = @"Edit"; } @end \ No newline at end of file From 5c7e387ac3c8dde65bd9ca8636464753712f80f6 Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Thu, 2 Jan 2014 22:14:01 -0700 Subject: [PATCH 6/7] Revert "Added minor code to test that the database was decrypted successfully. The cryptorStatus != kCCSuccess conditional never seems to be triggered after testing with several bad passwords." This reverts commit f125e2fb41be12cca4c9e310774cbc3fcc74ea4f. --- KeePassKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeePassKit b/KeePassKit index 24cb9124..dd4bb1d7 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 24cb912488d23599a325b3842feb71f8ca77fd4a +Subproject commit dd4bb1d77ebb34c047aa0f1bb5e874b301b874ea From 4abe4940ae54a23ebc848636e82e04606e38bbf4 Mon Sep 17 00:00:00 2001 From: Chhom Seng Date: Thu, 2 Jan 2014 22:16:34 -0700 Subject: [PATCH 7/7] Revert the KeePassKit commit. I seem to have performed this commit wrong. --- KeePassKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KeePassKit b/KeePassKit index dd4bb1d7..24cb9124 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit dd4bb1d77ebb34c047aa0f1bb5e874b301b874ea +Subproject commit 24cb912488d23599a325b3842feb71f8ca77fd4a