From 3574c99275662179fece647972ecb8a534bd48e2 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 16 Mar 2023 20:51:10 +0100 Subject: [PATCH] qml: in the password dialogs, disable the password confirmation line if the first entered password is too short. Without that, a user may enter two passwords that are identical but too short, and then click on the eye icon in order to discover that they actuall are identical.. and only at this point guess that the size might be the problem. Also, raise the minimum length to 6, because that is what is was on Kivy. One of the password dialogs still had two eye icons; that was only fixed in the wizard. I guess that could be avoided if both dialogs used the same code. --- electrum/gui/qml/components/PasswordDialog.qml | 5 ++++- electrum/gui/qml/components/wizard/WCWalletPassword.qml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qml/components/PasswordDialog.qml b/electrum/gui/qml/components/PasswordDialog.qml index 743333e48..a15ff532f 100644 --- a/electrum/gui/qml/components/PasswordDialog.qml +++ b/electrum/gui/qml/components/PasswordDialog.qml @@ -67,6 +67,9 @@ ElDialog { id: pw_2 Layout.leftMargin: constants.paddingXLarge visible: confirmPassword + showReveal: false + echoMode: pw_1.echoMode + enabled: pw_1.text.length >= 6 } } @@ -74,7 +77,7 @@ ElDialog { Layout.fillWidth: true text: qsTr("Ok") icon.source: '../../icons/confirmed.png' - enabled: confirmPassword ? pw_1.text.length > 4 && pw_1.text == pw_2.text : true + enabled: confirmPassword ? pw_1.text.length >= 6 && pw_1.text == pw_2.text : true onClicked: { password = pw_1.text passworddialog.accept() diff --git a/electrum/gui/qml/components/wizard/WCWalletPassword.qml b/electrum/gui/qml/components/wizard/WCWalletPassword.qml index 3da0cec99..73a7e46c0 100644 --- a/electrum/gui/qml/components/wizard/WCWalletPassword.qml +++ b/electrum/gui/qml/components/wizard/WCWalletPassword.qml @@ -5,7 +5,7 @@ import QtQuick.Controls 2.1 import "../controls" WizardComponent { - valid: password1.text === password2.text && password1.text.length > 4 + valid: password1.text === password2.text && password1.text.length >= 6 function apply() { wizard_data['password'] = password1.text @@ -25,6 +25,7 @@ WizardComponent { id: password2 showReveal: false echoMode: password1.echoMode + enabled: password1.text.length >= 6 } } }