Files
pallectrum/electrum/gui/qml/components/PasswordDialog.qml
ThomasV 3574c99275 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.
2023-03-16 20:51:17 +01:00

88 lines
2.1 KiB
QML

import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0
import org.electrum 1.0
import "controls"
ElDialog {
id: passworddialog
title: qsTr("Enter Password")
iconSource: Qt.resolvedUrl('../../icons/lock.png')
property bool confirmPassword: false
property string password
property string infotext
parent: Overlay.overlay
modal: true
anchors.centerIn: parent
width: parent.width * 4/5
padding: 0
Overlay.modal: Rectangle {
color: "#aa000000"
}
ColumnLayout {
id: rootLayout
width: parent.width
spacing: 0
ColumnLayout {
id: password_layout
Layout.leftMargin: constants.paddingXXLarge
Layout.rightMargin: constants.paddingXXLarge
InfoTextArea {
visible: infotext
text: infotext
Layout.bottomMargin: constants.paddingMedium
Layout.fillWidth: true
}
Label {
Layout.fillWidth: true
text: qsTr('Password')
color: Material.accentColor
}
PasswordField {
id: pw_1
Layout.leftMargin: constants.paddingXLarge
}
Label {
Layout.fillWidth: true
text: qsTr('Password (again)')
visible: confirmPassword
color: Material.accentColor
}
PasswordField {
id: pw_2
Layout.leftMargin: constants.paddingXLarge
visible: confirmPassword
showReveal: false
echoMode: pw_1.echoMode
enabled: pw_1.text.length >= 6
}
}
FlatButton {
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
onClicked: {
password = pw_1.text
passworddialog.accept()
}
}
}
}