qml: OTP dialog improvements
This commit is contained in:
@@ -44,27 +44,30 @@ ElDialog {
|
|||||||
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhDigitsOnly
|
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhDigitsOnly
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
focus: true
|
focus: true
|
||||||
|
enabled: !_waiting
|
||||||
|
Keys.onPressed: _otpError = ''
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (activeFocus)
|
if (text.length == 6) {
|
||||||
_otpError = ''
|
_waiting = true
|
||||||
|
Daemon.currentWallet.submitOtp(otpEdit.text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
opacity: _otpError ? 1 : 0
|
Layout.topMargin: constants.paddingMedium
|
||||||
|
Layout.bottomMargin: constants.paddingMedium
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
text: _otpError
|
text: _otpError
|
||||||
color: constants.colorError
|
color: constants.colorError
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
BusyIndicator {
|
||||||
Layout.columnSpan: 2
|
anchors.centerIn: parent
|
||||||
Layout.alignment: Qt.AlignHCenter
|
width: constants.iconSizeXLarge
|
||||||
text: qsTr('Submit')
|
height: constants.iconSizeXLarge
|
||||||
enabled: !_waiting
|
visible: _waiting
|
||||||
onClicked: {
|
running: _waiting
|
||||||
_waiting = true
|
|
||||||
Daemon.currentWallet.submitOtp(otpEdit.text)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,7 +538,9 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def submitOtp(self, otp):
|
def submitOtp(self, otp):
|
||||||
self._otp_on_submit(otp)
|
def submit_otp_task():
|
||||||
|
self._otp_on_submit(otp)
|
||||||
|
threading.Thread(target=submit_otp_task).start()
|
||||||
|
|
||||||
def broadcast(self, tx):
|
def broadcast(self, tx):
|
||||||
assert tx.is_complete()
|
assert tx.is_complete()
|
||||||
|
|||||||
Reference in New Issue
Block a user