password is updated (if set) for entries created via template

This commit is contained in:
michael starke
2016-07-26 16:18:15 +02:00
parent 3fd65f510e
commit c9085f20a1

View File

@@ -604,6 +604,19 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
KPKGroup *group = self.selectedGroups.count == 1 ? self.selectedGroups.firstObject : nil;
if(templateEntry && group) {
KPKEntry *copy = [templateEntry copyWithTitle:templateEntry.title options:kKPKCopyOptionNone];
BOOL updatePassword = [[NSUserDefaults standardUserDefaults] boolForKey:kMPSettingsKeyUpdatePasswordOnTemplateEntries];
if( updatePassword ) {
BOOL undoEnabled = self.undoManager.isUndoRegistrationEnabled;
[self.undoManager disableUndoRegistration];
NSString *password = [NSString passwordWithDefaultSettings];
if( password ) {
copy.password = password;
}
if(undoEnabled) {
[self.undoManager enableUndoRegistration];
}
}
[copy addToGroup:group];
[self.undoManager setActionName:NSLocalizedString(@"ADD_TREMPLATE_ENTRY", "")];
}