From 3295671e5b04cbe1427a1966e8220f6b60eb840b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 24 Aug 2022 16:16:50 +0200 Subject: [PATCH] qml: show when PIN is wrong --- electrum/gui/qml/components/Pin.qml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/electrum/gui/qml/components/Pin.qml b/electrum/gui/qml/components/Pin.qml index 663c18281..761c22c7c 100644 --- a/electrum/gui/qml/components/Pin.qml +++ b/electrum/gui/qml/components/Pin.qml @@ -39,6 +39,8 @@ ElDialog { property int _phase: mode == 'enter' ? 1 : 0 // 0 = existing pin, 1 = new pin, 2 = re-enter new pin property string _pin + property bool checkError: false + function submit() { if (_phase == 0) { if (pin.text == pincode) { @@ -48,6 +50,9 @@ ElDialog { else _phase = 1 return + } else { + pin.text = '' + checkError = true } } if (_phase == 1) { @@ -126,12 +131,20 @@ ElDialog { echoMode: TextInput.Password focus: true onTextChanged: { + checkError = false if (text.length == 6) { submit() } } } + Label { + opacity: checkError ? 1 : 0 + text: qsTr('Wrong PIN') + color: constants.colorError + Layout.alignment: Qt.AlignHCenter + } + Item { Layout.fillHeight: true; Layout.preferredWidth: 1 } }