1
0

trustedcoin: validate numeric format of OTP user entry (fixes #8905)

This commit is contained in:
Sander van Grieken
2024-02-21 13:31:06 +01:00
parent 9799603779
commit da1727b2f7
2 changed files with 7 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ WizardComponent {
Layout.alignment: Qt.AlignHCenter
focus: true
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhDigitsOnly
validator: IntValidator {bottom: 0; top: 999999;}
font.family: FixedFont
font.pixelSize: constants.fontSizeLarge
onTextChanged: {

View File

@@ -527,9 +527,14 @@ class WCShowConfirmOTP(WizardComponent):
def on_otp_edited(self):
self.otp_status_l.setVisible(False)
text = self.otp_e.text()
if len(text) > 0:
try:
otp_int = int(text)
except ValueError:
return
if len(text) == 6:
# verify otp
self.wizard.trustedcoin_qhelper.checkOtp(self.wizard.trustedcoin_qhelper.shortId, int(text))
self.wizard.trustedcoin_qhelper.checkOtp(self.wizard.trustedcoin_qhelper.shortId, otp_int)
self.setEnabled(False)
self.spinner_l.setVisible(True)
self.spinner.start()