Skip to content

Commit

Permalink
feat(code gen GUI): Added 3 retries of SMS PIN (if attempt failed) (#432
Browse files Browse the repository at this point in the history
)
  • Loading branch information
IAmWebSA committed Jun 12, 2021
1 parent 2055881 commit 8970167
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tools/gui/qtcodegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,16 @@ def code_gen(self):
QtCore.QThread.msleep(100)
return False

# code bestätigen
# 3 Versuche für die SMS-Code-Eingabe
self.sendSignalAndWait("signalShowInput","SMSCODE")

#stop requested in the meanwhile?
if self.stopped is True:
return False

if its.code_bestaetigen(token, cookies, self.sms_pin, self.plz_impfzentrum):
self.sendSignalAndWait("signalShowInput","SMSCODE_OK")
return True
# code bestätigen
# allow 3 retries
for _ in range(3):
if self.stopped is False:
self.sendSignalAndWait("signalShowInput","SMSCODE")
if its.code_bestaetigen(token, cookies, self.sms_pin, self.plz_impfzentrum):
self.sendSignalAndWait("signalShowInput","SMSCODE_OK")
return True
else:
return False

print("\nSMS-Code ungültig")
print("Die Code-Generierung war leider nicht erfolgreich.")
Expand Down Expand Up @@ -258,7 +257,6 @@ def showInputDlg(self, dlgType):
break
except ValidationError as exc:
QtWidgets.QMessageBox.critical(self, "Geburtsdatum ungültiges Format", "Das Datum entspricht nicht dem richtigen Format (DD.MM.YYYY).")

elif dlgType == "SMSCODE":
text, ok = QtWidgets.QInputDialog.getText(self, 'SMS Code',
'Du erhältst gleich eine SMS mit einem Code zur Bestätigung deiner Telefonnummer\n'
Expand All @@ -270,8 +268,10 @@ def showInputDlg(self, dlgType):
else:
self.hardClose()
elif dlgType == "SMSCODE_OK":
QtWidgets.QMessageBox.information(self, "Erfolgreich", "Code erfolgreich generiert. Du kannst jetzt mit der Terminsuche fortfahren.")
self.worker.signalUpdateData.emit("SMSCODE_OK","")
ret = QtWidgets.QMessageBox.information(self, "Erfolgreich", "Code erfolgreich generiert. Du kannst jetzt mit der Terminsuche fortfahren.",QMessageBox.StandardButton.Ok)
if ret == QMessageBox.StandardButton.Ok:
self.worker.signalUpdateData.emit("SMSCODE_OK","")
self.hardClose()

def showDlg(self, strMode, strTxt):
if strMode == "MISSING_KONTAKT":
Expand Down

0 comments on commit 8970167

Please sign in to comment.