mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix template after autofill search save
This commit is contained in:
@@ -695,7 +695,10 @@ class GroupActivity : LockingActivity(),
|
||||
|
||||
private fun updateEntryWithSearchInfo(entry: Entry, searchInfo: SearchInfo) {
|
||||
val newEntry = Entry(entry)
|
||||
newEntry.setEntryInfo(mDatabase, newEntry.getEntryInfo(mDatabase, true).apply {
|
||||
newEntry.setEntryInfo(mDatabase, newEntry.getEntryInfo(mDatabase,
|
||||
raw = true,
|
||||
removeTemplateConfiguration = false
|
||||
).apply {
|
||||
saveSearchInfo(mDatabase, searchInfo)
|
||||
})
|
||||
// In selection mode, it's forced read-only, so update not allowed
|
||||
|
||||
@@ -397,10 +397,16 @@ class Entry : Node, EntryVersionedInterface<Group> {
|
||||
* Retrieve generated entry info.
|
||||
* If are not [raw] data, remove parameter fields and add auto generated elements in auto custom fields
|
||||
*/
|
||||
fun getEntryInfo(database: Database?, raw: Boolean = false): EntryInfo {
|
||||
fun getEntryInfo(database: Database?,
|
||||
raw: Boolean = false,
|
||||
removeTemplateConfiguration: Boolean = true): EntryInfo {
|
||||
val entryInfo = EntryInfo()
|
||||
// Remove unwanted template fields
|
||||
(database?.removeTemplateConfiguration(this) ?: this).apply {
|
||||
val baseInfo = if (removeTemplateConfiguration)
|
||||
database?.removeTemplateConfiguration(this) ?: this
|
||||
else
|
||||
this
|
||||
baseInfo.apply {
|
||||
if (raw)
|
||||
database?.stopManageEntry(this)
|
||||
else
|
||||
|
||||
@@ -170,24 +170,18 @@ class EntryInfo : NodeInfo {
|
||||
|
||||
if (database?.allowEntryCustomFields() == true) {
|
||||
val creditCard: CreditCard? = registerInfo.creditCard
|
||||
|
||||
creditCard?.let { cc ->
|
||||
cc.cardholder?.let {
|
||||
val v = ProtectedString(false, it)
|
||||
addUniqueField(Field(TemplateField.LABEL_HOLDER, v))
|
||||
}
|
||||
cc.expiration?.let {
|
||||
expires = true
|
||||
expiryTime = DateInstant(cc.expiration.millis)
|
||||
}
|
||||
cc.number?.let {
|
||||
val v = ProtectedString(false, it)
|
||||
addUniqueField(Field(TemplateField.LABEL_NUMBER, v))
|
||||
}
|
||||
cc.cvv?.let {
|
||||
val v = ProtectedString(true, it)
|
||||
addUniqueField(Field(TemplateField.LABEL_CVV, v))
|
||||
}
|
||||
creditCard?.cardholder?.let {
|
||||
addUniqueField(Field(TemplateField.LABEL_HOLDER, ProtectedString(false, it)))
|
||||
}
|
||||
creditCard?.expiration?.let {
|
||||
expires = true
|
||||
expiryTime = DateInstant(creditCard.expiration.millis)
|
||||
}
|
||||
creditCard?.number?.let {
|
||||
addUniqueField(Field(TemplateField.LABEL_NUMBER, ProtectedString(false, it)))
|
||||
}
|
||||
creditCard?.cvv?.let {
|
||||
addUniqueField(Field(TemplateField.LABEL_CVV, ProtectedString(true, it)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user