Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion electrum/gui/qml/components/PasswordDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ElDialog {
property bool confirmPassword: false
property string infotext
property string errorMessage
readonly property int minimumPasswordLength: 6

signal passwordEntered(string password)

Expand Down Expand Up @@ -78,6 +79,21 @@ ElDialog {
}
}

InfoTextArea {
Layout.fillWidth: true
visible: confirmPassword && text !== ''
text: {
if (pw_1.text.length > 0 && pw_1.text.length < minimumPasswordLength)
return qsTr('Password must be at least %1 characters.').arg(minimumPasswordLength)
if (pw_2.text.length > 0 && pw_1.text !== pw_2.text)
return qsTr("Passwords don't match")
return ''
}
iconStyle: InfoTextArea.IconStyle.Warn
backgroundColor: constants.darkerDialogBackground
compact: true
}

Label {
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignHCenter
Expand All @@ -96,7 +112,9 @@ ElDialog {
Layout.fillWidth: true
text: qsTr("Ok")
icon.source: '../../icons/confirmed.png'
enabled: confirmPassword ? pw_1.text.length >= 6 && pw_1.text == pw_2.text : true
enabled: confirmPassword
? pw_1.text.length >= minimumPasswordLength && pw_1.text == pw_2.text
: true
onClicked: {
passwordEntered(pw_1.text)
}
Expand Down