From 88612e2aad5a4cbb6ee069f9495345d0d932c88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20=C3=87akar?= Date: Fri, 27 Dec 2024 15:36:16 +0300 Subject: [PATCH] Fix issue #4304 - The cause of the error is that the password validation logic runs for both password fields at the same time. When entering the first password, the second password field is empty, which causes the 'passwords do not match' error. This can be fixed by updating the code as follows: --- .../ui/dialogs/EncryptAuthenticateDialog.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/dialogs/EncryptAuthenticateDialog.kt b/app/src/main/java/com/amaze/filemanager/ui/dialogs/EncryptAuthenticateDialog.kt index 11763e598b..3841007f70 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/dialogs/EncryptAuthenticateDialog.kt +++ b/app/src/main/java/com/amaze/filemanager/ui/dialogs/EncryptAuthenticateDialog.kt @@ -201,15 +201,19 @@ object EncryptAuthenticateDialog { warningTextInputLayout, btnOK, ) { text: String -> - if (text.isNotBlank() && - text == comparingPasswordField.text.toString() && - filenameIsValid(encryptSaveAsEditText.text.toString(), useAzeEncrypt) - ) { - ReturnState() - } else if (text.isBlank()) { - ReturnState(STATE_ERROR, R.string.field_empty) + if (text.isNotBlank()) { + if (comparingPasswordField.text.toString().isBlank() || + text == comparingPasswordField.text.toString()) { + if (filenameIsValid(encryptSaveAsEditText.text.toString(), useAzeEncrypt)) { + ReturnState() + } else { + ReturnState(STATE_ERROR, R.string.empty_string) + } + } else { + ReturnState(STATE_ERROR, R.string.password_no_match) + } } else { - ReturnState(STATE_ERROR, R.string.password_no_match) + ReturnState(STATE_ERROR, R.string.field_empty) } }