diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
index 4db526a8d..664ce04d7 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt
@@ -589,6 +589,11 @@ class PasswordActivity : StylishActivity(),
loadDatabase(password, keyUri)
}
+ private fun removePassword() {
+ passwordView?.setText("")
+ checkboxPasswordView?.isChecked = false
+ }
+
private fun loadDatabase(password: String?, keyFile: Uri?) {
// Deactivate the open button
@@ -596,6 +601,10 @@ class PasswordActivity : StylishActivity(),
// Hide credentials
unlockContainer?.visibility = View.INVISIBLE
+ if (PreferencesUtil.deletePasswordAfterConnexionAttempt(this)) {
+ removePassword()
+ }
+
// Clear before we load
val database = App.currentDatabase
database.closeAndClear(applicationContext.filesDir)
@@ -632,12 +641,10 @@ class PasswordActivity : StylishActivity(),
reInitWithFingerprintMode()
}
- // Show credentials
- unlockContainer?.visibility = View.VISIBLE
- // Activate the open button
- confirmButtonView?.isEnabled = true
-
if (result.isSuccess) {
+ // Remove the password in view in all cases
+ removePassword()
+
if (database.validatePasswordEncoding(password)) {
launchGroupActivity()
} else {
@@ -649,10 +656,16 @@ class PasswordActivity : StylishActivity(),
}
}
} else {
+ // Activate the open button
+ confirmButtonView?.isEnabled = true
+
if (result.message != null && result.message!!.isNotEmpty()) {
Toast.makeText(this@PasswordActivity, result.message, Toast.LENGTH_LONG).show()
}
}
+
+ // Show credentials
+ unlockContainer?.visibility = View.VISIBLE
}
}
}
diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
index 4995eb35a..d533fa2be 100644
--- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt
@@ -227,6 +227,12 @@ object PreferencesUtil {
context.resources.getBoolean(R.bool.enable_read_only_default))
}
+ fun deletePasswordAfterConnexionAttempt(context: Context): Boolean {
+ val prefs = PreferenceManager.getDefaultSharedPreferences(context)
+ return prefs.getBoolean(context.getString(R.string.delete_entered_password_key),
+ context.resources.getBoolean(R.bool.delete_entered_password_default))
+ }
+
fun enableKeyboardNotificationEntry(context: Context): Boolean {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.keyboard_notification_entry_key),
diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml
index 6e41f4060..2803d78b7 100644
--- a/app/src/main/res/values/donottranslate.xml
+++ b/app/src/main/res/values/donottranslate.xml
@@ -71,6 +71,8 @@
false
enable_read_only_key
false
+ delete_entered_password_key
+ true
omitbackup
true
app_timeout_key
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5092990f3..6da5ac176 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -328,6 +328,8 @@
Enable the \"Open\" button if no password identification is selected
Write-protected
Open your database read-only by default
+ Delete password
+ Deletes the password entered after a connection attempt
Educational screens
Highlight the elements to learn how the app works
diff --git a/app/src/main/res/xml/application_preferences.xml b/app/src/main/res/xml/application_preferences.xml
index c0fadce0e..73864adba 100644
--- a/app/src/main/res/xml/application_preferences.xml
+++ b/app/src/main/res/xml/application_preferences.xml
@@ -33,6 +33,11 @@
android:title="@string/enable_read_only_title"
android:summary="@string/enable_read_only_summary"
android:defaultValue="@bool/enable_read_only_default"/>
+