From 7625531c8c912920f61bd150253d39fd6c261b03 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 11 Feb 2026 15:59:04 +0200 Subject: [PATCH] Show courier delivered cards warning when card is not activated WE2-1182 Signed-off-by: Raul Metsma --- src/controller/certandpininfo.hpp | 3 +- .../command-handlers/certificatereader.cpp | 25 ++++++---- .../command-handlers/certificatereader.hpp | 2 +- src/controller/commandhandler.hpp | 2 +- src/controller/qeid.hpp | 1 - .../threads/commandhandlerrunthread.hpp | 2 +- src/ui/dialog.ui | 15 ++++-- src/ui/translations/cs.ts | 10 ++-- src/ui/translations/de.ts | 10 ++-- src/ui/translations/en.ts | 8 ++-- src/ui/translations/et.ts | 10 ++-- src/ui/translations/fi.ts | 10 ++-- src/ui/translations/fr.ts | 10 ++-- src/ui/translations/hr.ts | 10 ++-- src/ui/translations/nl.ts | 10 ++-- src/ui/translations/ru.ts | 10 ++-- src/ui/translations/sk.ts | 10 ++-- src/ui/webeiddialog.cpp | 46 +++++++++++++++---- src/ui/webeiddialog.hpp | 2 + 19 files changed, 119 insertions(+), 77 deletions(-) diff --git a/src/controller/certandpininfo.hpp b/src/controller/certandpininfo.hpp index bd371fb4..9ef0aa7d 100644 --- a/src/controller/certandpininfo.hpp +++ b/src/controller/certandpininfo.hpp @@ -55,7 +55,8 @@ struct EidCertificateAndPinInfo QSslCertificate certificate {}; CertificateInfo certInfo; PinInfo pinInfo; - bool cardActive = true; + bool pin1Active = true; + bool pin2Active = true; }; Q_DECLARE_METATYPE(EidCertificateAndPinInfo) diff --git a/src/controller/command-handlers/certificatereader.cpp b/src/controller/command-handlers/certificatereader.cpp index 9f294bb4..e377050c 100644 --- a/src/controller/command-handlers/certificatereader.cpp +++ b/src/controller/command-handlers/certificatereader.cpp @@ -31,7 +31,7 @@ using namespace electronic_id; namespace { -EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr& eid, +EidCertificateAndPinInfo getCertificateWithStatusAndInfo(ElectronicID::ptr&& eid, const CertificateType certificateType) { const auto certificateBytes = eid->getCertificate(certificateType); @@ -70,19 +70,23 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr info.maxRetry, }, .readerHasPinPad = eid->smartcard().readerHasPinPad()}; - bool cardActivated = info.pinActive; - if (certificateType == CertificateType::AUTHENTICATION && eid->type() == ElectronicID::EstEID - && eid->name() == "EstEIDThales") { - cardActivated = eid->signingPinInfo().pinActive; + bool pin1Active = true; + bool pin2Active = true; + if (eid->type() == ElectronicID::EstEID && eid->name() == "EstEIDThales") { + auto infoOther = + certificateType.isAuthentication() ? eid->signingPinInfo() : eid->authPinInfo(); + pin1Active = certificateType.isAuthentication() ? info.pinActive : infoOther.pinActive; + pin2Active = certificateType.isAuthentication() ? infoOther.pinActive : info.pinActive; } return { - .eid = eid, + .eid = std::move(eid), .certificateBytesInDer = std::move(certificateDer), .certificate = certificate, .certInfo = std::move(certInfo), .pinInfo = std::move(pinInfo), - .cardActive = cardActivated, + .pin1Active = pin1Active, + .pin2Active = pin2Active, }; } @@ -96,7 +100,7 @@ CertificateReader::CertificateReader(const CommandWithArguments& cmd) : CommandH } } -void CertificateReader::run(const std::vector& eids) +void CertificateReader::run(std::vector&& eids) { REQUIRE_NOT_EMPTY_CONTAINS_NON_NULL_PTRS(eids) @@ -105,9 +109,10 @@ void CertificateReader::run(const std::vector& eids) std::vector certAndPinInfos; certAndPinInfos.reserve(eids.size()); - for (const auto& eid : eids) { + for (auto& eid : eids) { try { - certAndPinInfos.push_back(getCertificateWithStatusAndInfo(eid, certificateType)); + certAndPinInfos.push_back( + getCertificateWithStatusAndInfo(std::move(eid), certificateType)); } catch (const WrongCertificateTypeError&) { // Ignore eIDs that don't support the given ceritifcate type. } diff --git a/src/controller/command-handlers/certificatereader.hpp b/src/controller/command-handlers/certificatereader.hpp index 8a3930ba..ba92fd1d 100644 --- a/src/controller/command-handlers/certificatereader.hpp +++ b/src/controller/command-handlers/certificatereader.hpp @@ -33,7 +33,7 @@ class CertificateReader : public CommandHandler public: explicit CertificateReader(const CommandWithArguments& cmd); - void run(const std::vector& eids) override; + void run(std::vector&& eids) override; void connectSignals(const WebEidUI* window) override; protected: diff --git a/src/controller/commandhandler.hpp b/src/controller/commandhandler.hpp index 841563ff..a7392bbc 100644 --- a/src/controller/commandhandler.hpp +++ b/src/controller/commandhandler.hpp @@ -33,7 +33,7 @@ class CommandHandler : public QObject public: using ptr = std::unique_ptr; - virtual void run(const std::vector& eids) = 0; + virtual void run(std::vector&& eids) = 0; virtual void connectSignals(const WebEidUI* window) = 0; virtual QVariantMap onConfirm(WebEidUI* window, const EidCertificateAndPinInfo& certAndPinInfo) = 0; diff --git a/src/controller/qeid.hpp b/src/controller/qeid.hpp index 12898eb8..ac60ba25 100644 --- a/src/controller/qeid.hpp +++ b/src/controller/qeid.hpp @@ -27,5 +27,4 @@ #include Q_DECLARE_METATYPE(electronic_id::ElectronicID::ptr) -Q_DECLARE_METATYPE(std::vector) Q_DECLARE_METATYPE(electronic_id::VerifyPinFailed::Status) diff --git a/src/controller/threads/commandhandlerrunthread.hpp b/src/controller/threads/commandhandlerrunthread.hpp index dd552956..940c45c0 100644 --- a/src/controller/threads/commandhandlerrunthread.hpp +++ b/src/controller/threads/commandhandlerrunthread.hpp @@ -39,7 +39,7 @@ class CommandHandlerRunThread : public ControllerChildThread } private: - void doRun() override { commandHandler.run(eids); } + void doRun() override { commandHandler.run(std::move(eids)); } CommandHandler& commandHandler; std::vector eids; diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 6ee05a17..1d87fa4a 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -23,7 +23,7 @@ QWidget { background-color: white; font-size: 14px; -font-family: "Roboto"; +font-family: Roboto, Helvetica; color: black; } QPushButton { @@ -41,19 +41,24 @@ background-color: #F5EBED; QPushButton:pressed { background-color: #E1C1C6; } -QPushButton::default, #helpButton { +QPushButton:default, #helpButton { color: white; border-color: #2F70B6; background-color: #2F70B6; } -QPushButton::default:hover, #helpButton:hover { +QPushButton:default:hover, QPushButton:default:focus, +#helpButton:hover, #helpButton:focus { border-color: #2B66A6; background-color: #2B66A6; } -QPushButton::default:pressed, #helpButton:pressed { +QPushButton:default:pressed, #helpButton:pressed { border-color: #215081; background-color: #215081; } +QPushButton:default:disabled { +border-color: #82A9D3; +background-color: #82A9D3; +} #langButton { color: #003168; border: 0px; @@ -182,7 +187,7 @@ border: none; border-radius: 4px; - Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. <a href="https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/">Additional information</a> + Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. <a href="https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/">Additional information</a> true diff --git a/src/ui/translations/cs.ts b/src/ui/translations/cs.ts index 93fe5a70..eac02e98 100644 --- a/src/ui/translations/cs.ts +++ b/src/ui/translations/cs.ts @@ -184,9 +184,13 @@ Operace se nezdařila - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + Zadávání PINu je zakázáno + Card driver error. Please try again. Chyba ovladače karty. Zkuste to prosím znovu. @@ -308,10 +312,6 @@ Active language CS - - PIN entry disabled - Zadávání PINu je zakázáno. - English Active language accessible diff --git a/src/ui/translations/de.ts b/src/ui/translations/de.ts index c676935c..3855b16e 100644 --- a/src/ui/translations/de.ts +++ b/src/ui/translations/de.ts @@ -182,9 +182,13 @@ Der Vorgang ist fehlgeschlagen - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + PIN-Eingabe deaktiviert + Card driver error. Please try again. Kartentreiberfehler. Bitte versuche es erneut. @@ -306,10 +310,6 @@ Active language DE - - PIN entry disabled - PIN-Eingabe deaktiviert. - English Active language accessible diff --git a/src/ui/translations/en.ts b/src/ui/translations/en.ts index 00be86c5..271ec7fa 100644 --- a/src/ui/translations/en.ts +++ b/src/ui/translations/en.ts @@ -181,6 +181,10 @@ Operation failed Operation failed + + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + PIN entry disabled PIN entry disabled @@ -306,10 +310,6 @@ Active language EN - - PIN entry disabled - PIN entry disabled - English Active language accessible diff --git a/src/ui/translations/et.ts b/src/ui/translations/et.ts index 2b18d689..b1840709 100644 --- a/src/ui/translations/et.ts +++ b/src/ui/translations/et.ts @@ -129,13 +129,17 @@ PinPad timed out waiting for customer interaction. PinPad lugeja toiming aegus. + + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + ID-kaardiga isikutuvastamine ja allkirjastamine ei ole veel võimalik. ID-kaardi kasutamiseks tuleb see aktiveerida Politsei- ja Piirivalveameti iseteeninduses. <a href="https://www.politsei.ee/et/iseteenindus">Aktiveeri ID-kaart</a> + PIN entry cancelled. PIN-koodi sisestamine katkestati. PIN entry disabled - + PIN'i sisestamine on keelatud Launch the Smart Card service @@ -306,10 +310,6 @@ Active language ET - - PIN entry disabled - PIN'i sisestamine on keelatud. - English Active language accessible diff --git a/src/ui/translations/fi.ts b/src/ui/translations/fi.ts index 6a240b4e..30169981 100644 --- a/src/ui/translations/fi.ts +++ b/src/ui/translations/fi.ts @@ -162,9 +162,13 @@ Toiminto epäonnistui - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + PIN-koodin syöttö ei ole käytössä + Card driver error. Please try again. Kortinlukijan virhe. Yritä uudelleen. @@ -306,10 +310,6 @@ Active language FI - - PIN entry disabled - PIN-koodin syöttö ei ole käytössä. - English Active language accessible diff --git a/src/ui/translations/fr.ts b/src/ui/translations/fr.ts index 0995deb3..6e95c1a7 100644 --- a/src/ui/translations/fr.ts +++ b/src/ui/translations/fr.ts @@ -182,9 +182,13 @@ L'opération a échoué - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + Saisie du code PIN désactivée + Card driver error. Please try again. Erreur de pilote de carte. Veuillez réessayer. @@ -306,10 +310,6 @@ Active language FR - - PIN entry disabled - Saisie du code PIN désactivée. - English Active language accessible diff --git a/src/ui/translations/hr.ts b/src/ui/translations/hr.ts index de2e6397..5915662a 100644 --- a/src/ui/translations/hr.ts +++ b/src/ui/translations/hr.ts @@ -208,9 +208,13 @@ - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + Unos PIN-a onemogućen + PIN is locked. Unblock and try again. PIN je zaključan. Odblokirajte ga i pokušajte ponovo. @@ -308,10 +312,6 @@ Active language HR - - PIN entry disabled - Unos PIN-a onemogućen. - English Active language accessible diff --git a/src/ui/translations/nl.ts b/src/ui/translations/nl.ts index 66320b14..e33b3164 100644 --- a/src/ui/translations/nl.ts +++ b/src/ui/translations/nl.ts @@ -182,9 +182,13 @@ Bewerking mislukt - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + PIN-invoer uitgeschakeld + Card driver error. Please try again. Fout met kaartstuurprogramma. Probeer het opnieuw. @@ -306,10 +310,6 @@ Active language NL - - PIN entry disabled - PIN-invoer uitgeschakeld. - English Active language accessible diff --git a/src/ui/translations/ru.ts b/src/ui/translations/ru.ts index f5b60f8c..3aef1ff1 100644 --- a/src/ui/translations/ru.ts +++ b/src/ui/translations/ru.ts @@ -183,9 +183,13 @@ Operation failed Операция не удалась + + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + Идентификация и подписание документов с помощью ID карты пока невозможны. Для использования удостоверения личности его необходимо активировать в системе самообслуживания Управления полиции и пограничной охраны. <a href="https://www.politsei.ee/ru/samoobsluzhivanie">Активировать ID карту</a> + PIN entry disabled - + Ввод PIN запрещён Card driver error. Please try again. @@ -308,10 +312,6 @@ Active language RU - - PIN entry disabled - Ввод PIN запрещён. - English Active language accessible diff --git a/src/ui/translations/sk.ts b/src/ui/translations/sk.ts index bbf6bce2..76c7634a 100644 --- a/src/ui/translations/sk.ts +++ b/src/ui/translations/sk.ts @@ -184,9 +184,13 @@ Operácia zlyhala - PIN entry disabled + Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. <a href="https://www.politsei.ee/en/self-service-portal">Activate ID-card</a> + + PIN entry disabled + Zadávanie PIN je zakázané + Card driver error. Please try again. Chyba ovládača karty. Skúste to prosím znova. @@ -308,10 +312,6 @@ Active language SK - - PIN entry disabled - Zadávanie PIN je zakázané. - English Active language accessible diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp index d945ef0c..2b3b1fac 100644 --- a/src/ui/webeiddialog.cpp +++ b/src/ui/webeiddialog.cpp @@ -118,9 +118,8 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private) ui->okButton->setEnabled(true); if (auto* button = qobject_cast(ui->selectionGroup->checkedButton())) { - ui->lockedWarning->setHidden(button->certificateInfo().cardActive); - ui->okButton->setEnabled(currentCommand == CommandType::AUTHENTICATE - || button->certificateInfo().cardActive); + setupWarning(button->certificateInfo()); + ui->okButton->setEnabled(isCardActive(button->certificateInfo())); } ui->okButton->setFocus(); }); @@ -585,8 +584,8 @@ void WebEidDialog::setupPinPrompt(PinInfo pinInfo, bool cardActive) void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinInfo& certAndPin) { - ui->lockedWarning->setHidden(certAndPin.cardActive); - bool cardActive = currentCommand == CommandType::AUTHENTICATE || certAndPin.cardActive; + setupWarning(certAndPin); + bool cardActive = isCardActive(certAndPin); setupPinPrompt(certAndPin.pinInfo, cardActive); if (!cardActive) { return; @@ -617,9 +616,8 @@ void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinI void WebEidDialog::setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo) { - ui->lockedWarning->setHidden(certAndPinInfo.cardActive); - setupPinPrompt(certAndPinInfo.pinInfo, - currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.cardActive); + setupWarning(certAndPinInfo); + setupPinPrompt(certAndPinInfo.pinInfo, isCardActive(certAndPinInfo)); // The allowed character ranges are from the SafeNet eToken guide: // 1. English uppercase letters (ASCII 0x41...0x5A). // 2. English lowercase letters (ASCII 0x61...0x7A). @@ -653,6 +651,30 @@ void WebEidDialog::setupOK(Func func, const char* text, bool enabled) ui->helpButton->hide(); } +void WebEidDialog::setupWarning(const EidCertificateAndPinInfo& certAndPinInfo) +{ + ui->lockedWarning->setHidden(certAndPinInfo.pin1Active && certAndPinInfo.pin2Active); + if (!certAndPinInfo.pin1Active) { + setTrText( + ui->lockedWarning, + QT_TR_NOOP( + "Authentication and signing with the ID-card isn't possible yet. " + "ID-card must be activated in the Police and Border Guard Board’s self-service " + "portal in order to use it. " + "Activate ID-card")); + } else if (!certAndPinInfo.pin2Active) { + setTrText( + ui->lockedWarning, + QT_TR_NOOP( + "Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 " + "application in order to sign. " + "Additional information")); + } + resizeHeight(); +} + void WebEidDialog::displayPinBlockedError() { displayFatalError([] { return tr("PIN is locked. Unblock and try again."); }); @@ -688,6 +710,14 @@ void WebEidDialog::resizeHeight() adjustSize(); } +bool WebEidDialog::isCardActive(const EidCertificateAndPinInfo& certAndPinInfo) const noexcept +{ + if (!certAndPinInfo.pin1Active) { + return false; + } + return currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.pin2Active; +} + QPixmap WebEidDialog::pixmap(QLatin1String name) { return {":/images/%1%2.svg"_L1.arg(name, diff --git a/src/ui/webeiddialog.hpp b/src/ui/webeiddialog.hpp index 70ea697f..ee0ffa1e 100644 --- a/src/ui/webeiddialog.hpp +++ b/src/ui/webeiddialog.hpp @@ -107,6 +107,7 @@ class WebEidDialog final : public WebEidUI void setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo); template void setupOK(Func func, const char* text = {}, bool enabled = false); + void setupWarning(const EidCertificateAndPinInfo& certAndPinInfo); void displayPinBlockedError(); template void displayFatalError(Text message); @@ -114,6 +115,7 @@ class WebEidDialog final : public WebEidUI void showPinInputWarning(bool show); void resizeHeight(); + bool isCardActive(const EidCertificateAndPinInfo& certAndPinInfo) const noexcept; static QPixmap pixmap(QLatin1String name); constexpr static std::tuple retriableErrorToTextTitleAndIcon(RetriableError error) noexcept;