Locking a db now requests a password/key if none is set

This commit is contained in:
michael starke
2017-11-21 12:32:41 +01:00
parent 547e61fc4b
commit 775dbd07ee
2 changed files with 19 additions and 16 deletions

View File

@@ -856,10 +856,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
break; break;
case MPActionDatabaseSettings: case MPActionDatabaseSettings:
case MPActionEditPassword: case MPActionEditPassword:
valid &= !self.encrypted;
break;
case MPActionLock: case MPActionLock:
valid &= self.compositeKey.hasPasswordOrKeyFile; valid &= !self.encrypted;
break; break;
case MPActionShowEntryHistory: case MPActionShowEntryHistory:
valid &= (nil != targetEntry); valid &= (nil != targetEntry);

View File

@@ -343,8 +343,13 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
- (IBAction)lock:(id)sender { - (IBAction)lock:(id)sender {
MPDocument *document = [self document]; MPDocument *document = [self document];
if(!document.compositeKey.hasPasswordOrKeyFile) { if(!document.compositeKey) {
return; // Document needs a password/keyfile to be lockable [self editPasswordWithCompetionHandler:^(NSInteger result) {
if(result == NSModalResponseOK) {
[self lock:sender];
}
}];
return;
} }
if(document.encrypted) { if(document.encrypted) {
return; // Document already locked return; // Document already locked