diff -r 9082eb8f6571 -r b19cefceca15 src/eric7/WebBrowser/WebAuth/Fido2PinDialog.py --- a/src/eric7/WebBrowser/WebAuth/Fido2PinDialog.py Sat Jul 20 11:14:51 2024 +0200 +++ b/src/eric7/WebBrowser/WebAuth/Fido2PinDialog.py Mon Jul 22 10:15:41 2024 +0200 @@ -31,7 +31,7 @@ Class implementing a dialog to enter the current and potentially new PIN. """ - def __init__(self, mode, title, message, minLength, parent=None): + def __init__(self, mode, title, message, minLength, retries, parent=None): """ Constructor @@ -43,6 +43,8 @@ @type str @param minLength minimum PIN length @type int + @param retries number of attempts remaining before the security key get locked + @type int @param parent reference to the parent widget (defaults to None) @type QWidget (optional) """ @@ -63,6 +65,11 @@ self.descriptionLabel.setText(message) else: self.descriptionLabel.setVisible(False) + if self.__mode == Fido2PinDialogMode.SET: + self.remainingWidget.setVisible(False) + else: + self.remainingWidget.setVisible(True) + self.remainingLabel.setText(str(retries)) self.pinErrorLabel.setVisible(False) if mode == Fido2PinDialogMode.GET: @@ -91,15 +98,10 @@ """ messages = [] - if ( - self.__mode in (Fido2PinDialogMode.GET, Fido2PinDialogMode.CHANGE) - and not self.pinEdit.text() - ): - messages.append(self.tr("PIN must not be empty.")) if self.__mode in (Fido2PinDialogMode.SET, Fido2PinDialogMode.CHANGE): if len(self.newPinEdit.text()) < self.__minLength: messages.append( - self.tr("New PIN is TOO short (minimum length: {0}).").format( + self.tr("New PIN is too short (minimum length: {0}).").format( self.__minLength ) ) @@ -133,7 +135,7 @@ if len(errorMessages) == 1: msg = errorMessages[0] else: - msg = "<ul><li>{0}</li></ul>".format("</li><li>".join(errorMessages)) + msg = "- {0}".format("\n- ".join(errorMessages)) self.pinErrorLabel.setText(msg) self.pinErrorLabel.setVisible(True) @@ -169,9 +171,9 @@ self.newPinButton.setIcon(EricPixmapCache.getIcon("showPassword")) self.newPinEdit.setEchoMode(QLineEdit.EchoMode.Password) - self.confirmnewPinLabel.setVisible(not checked) - self.confirmPinnewEdit.setVisible(not checked) - self.on_newPinEdit_textEdited(self.newPinEdit.text()) + self.confirmNewPinLabel.setVisible(not checked) + self.confirmNewPinEdit.setVisible(not checked) + self.__checkPins() def getPins(self): """ @@ -184,7 +186,7 @@ return self.pinEdit.text(), None elif self.__mode == Fido2PinDialogMode.SET: return None, self.newPinEdit.text() - elif self.__mode == Fido2PinDialogMode.GET: + elif self.__mode == Fido2PinDialogMode.CHANGE: return self.pinEdit.text(), self.newPinEdit.text() else: return None, None