mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 00:02:28 +00:00
Locking a db now requests a password/key if none is set
This commit is contained in:
@@ -856,10 +856,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
break;
|
||||
case MPActionDatabaseSettings:
|
||||
case MPActionEditPassword:
|
||||
valid &= !self.encrypted;
|
||||
break;
|
||||
case MPActionLock:
|
||||
valid &= self.compositeKey.hasPasswordOrKeyFile;
|
||||
valid &= !self.encrypted;
|
||||
break;
|
||||
case MPActionShowEntryHistory:
|
||||
valid &= (nil != targetEntry);
|
||||
|
||||
@@ -343,8 +343,13 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
|
||||
|
||||
- (IBAction)lock:(id)sender {
|
||||
MPDocument *document = [self document];
|
||||
if(!document.compositeKey.hasPasswordOrKeyFile) {
|
||||
return; // Document needs a password/keyfile to be lockable
|
||||
if(!document.compositeKey) {
|
||||
[self editPasswordWithCompetionHandler:^(NSInteger result) {
|
||||
if(result == NSModalResponseOK) {
|
||||
[self lock:sender];
|
||||
}
|
||||
}];
|
||||
return;
|
||||
}
|
||||
if(document.encrypted) {
|
||||
return; // Document already locked
|
||||
|
||||
Reference in New Issue
Block a user