feat: OTP tag #2122

This commit is contained in:
J-Jamet
2025-10-07 11:56:14 +02:00
parent 989e47ed12
commit 02c514272e
4 changed files with 6 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ KeePassDX(4.2.0)
* Change Passkey Backup Eligibility & Backup State #2135 #2150 * Change Passkey Backup Eligibility & Backup State #2135 #2150
* Search settings #2112 #2181 #2187 * Search settings #2112 #2181 #2187
* Autofill refactoring #765 * Autofill refactoring #765
* Small fixes #2157 #2164 #2171 * Small fixes #2157 #2164 #2171 #2122
KeePassDX(4.1.9) KeePassDX(4.1.9)
* Fix landscape UI #2198 #2200 (@chenxiaolong) * Fix landscape UI #2198 #2200 (@chenxiaolong)

View File

@@ -40,6 +40,7 @@ object OtpEntryFields {
// Field from KeePassXC // Field from KeePassXC
private const val OTP_FIELD = "otp" private const val OTP_FIELD = "otp"
private const val OTP_TAG = "OTP"
// URL parameters (https://github.com/google/google-authenticator/wiki/Key-Uri-Format) // URL parameters (https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
private const val OTP_SCHEME = "otpauth" private const val OTP_SCHEME = "otpauth"
@@ -438,13 +439,14 @@ object OtpEntryFields {
fun EntryInfo.setOtp(otpString: String): Boolean { fun EntryInfo.setOtp(otpString: String): Boolean {
// Replace the OTP field // Replace the OTP field
parseOTPUri(otpString)?.let { otpElement -> parseOTPUri(otpString)?.let { otpElement ->
tags.put(OTP_TAG)
if (title.isEmpty()) if (title.isEmpty())
title = otpElement.issuer title = otpElement.issuer
if (username.isEmpty()) if (username.isEmpty())
username = otpElement.name username = otpElement.name
// Add OTP field // Add OTP field
val mutableCustomFields = customFields as ArrayList<Field> val mutableCustomFields = customFields as ArrayList<Field>
val otpField = OtpEntryFields.buildOtpField(otpElement, null, null) val otpField = buildOtpField(otpElement, null, null)
if (mutableCustomFields.contains(otpField)) { if (mutableCustomFields.contains(otpField)) {
mutableCustomFields.remove(otpField) mutableCustomFields.remove(otpField)
} }

View File

@@ -2,4 +2,4 @@
* Search settings #2112 #2181 * Search settings #2112 #2181
* Setting to close database after a Passkey selection #2187 * Setting to close database after a Passkey selection #2187
* Autofill refactoring #765 * Autofill refactoring #765
* Small fixes #2171 #2150 #2159 * Small fixes #2171 #2150 #2159 #2122

View File

@@ -2,4 +2,4 @@
* Paramètres de recherche #2112 #2181 * Paramètres de recherche #2112 #2181
* Paramètre de fermeture de la base après une sélection de Passkey #2187 * Paramètre de fermeture de la base après une sélection de Passkey #2187
* Refonte du remplissage automatique #765 * Refonte du remplissage automatique #765
* Petites corrections #2171 #2150 #2159 * Petites corrections #2171 #2150 #2159 #2122