mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Auto populate Title and Username from OTP Auth
This commit is contained in:
@@ -129,6 +129,11 @@ class EntryInfo : Parcelable {
|
|||||||
searchInfo.otpString?.let { otpString ->
|
searchInfo.otpString?.let { otpString ->
|
||||||
// Replace the OTP field
|
// Replace the OTP field
|
||||||
OtpEntryFields.parseOTPUri(otpString)?.let { otpElement ->
|
OtpEntryFields.parseOTPUri(otpString)?.let { otpElement ->
|
||||||
|
if (title.isEmpty())
|
||||||
|
title = otpElement.issuer
|
||||||
|
if (username.isEmpty())
|
||||||
|
username = otpElement.name
|
||||||
|
// Add OTP field
|
||||||
val mutableCustomFields = customFields as ArrayList<Field>
|
val mutableCustomFields = customFields as ArrayList<Field>
|
||||||
val otpField = OtpEntryFields.buildOtpField(otpElement, null, null)
|
val otpField = OtpEntryFields.buildOtpField(otpElement, null, null)
|
||||||
if (mutableCustomFields.contains(otpField)) {
|
if (mutableCustomFields.contains(otpField)) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
|||||||
override fun getName(resources: Resources): String {
|
override fun getName(resources: Resources): String {
|
||||||
otpString?.let { otpString ->
|
otpString?.let { otpString ->
|
||||||
OtpEntryFields.parseOTPUri(otpString)?.let { otpElement ->
|
OtpEntryFields.parseOTPUri(otpString)?.let { otpElement ->
|
||||||
return "${otpElement.type} (${Uri.decode(otpElement.issuer)} : ${Uri.decode(otpElement.name)})"
|
return "${otpElement.type} (${Uri.decode(otpElement.issuer)}:${Uri.decode(otpElement.name)})"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toString()
|
return toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user