From d0baa0ac73c4fd35872730fcc02c484f95f47872 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 --- lib/libelectronic-id | 2 +- src/controller/certandpininfo.hpp | 3 +- .../command-handlers/certificatereader.cpp | 21 +++++++---- .../command-handlers/certificatereader.hpp | 2 +- src/controller/commandhandler.hpp | 2 +- src/controller/qeid.hpp | 1 - .../threads/commandhandlerrunthread.hpp | 2 +- src/ui/languageselect.cpp | 3 +- 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 | 37 +++++++++++++++---- src/ui/webeiddialog.hpp | 1 + 20 files changed, 101 insertions(+), 71 deletions(-) diff --git a/lib/libelectronic-id b/lib/libelectronic-id index affadb37..8e2c4ad6 160000 --- a/lib/libelectronic-id +++ b/lib/libelectronic-id @@ -1 +1 @@ -Subproject commit affadb37f3db86e211e06f7fcaa1ddc3169f0de4 +Subproject commit 8e2c4ad681696d8794c72ca7ff5b96663e40d9a9 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..9efcb8a8 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; + bool pin1Active = true; + bool pin2Active = true; if (certificateType == CertificateType::AUTHENTICATION && eid->type() == ElectronicID::EstEID && eid->name() == "EstEIDThales") { - cardActivated = eid->signingPinInfo().pinActive; + 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 8ee76fa0..48e904ea 100644 --- a/src/controller/qeid.hpp +++ b/src/controller/qeid.hpp @@ -28,5 +28,4 @@ Q_DECLARE_METATYPE(electronic_id::AutoSelectFailed::Reason) 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/languageselect.cpp b/src/ui/languageselect.cpp index f932554b..db3aecef 100644 --- a/src/ui/languageselect.cpp +++ b/src/ui/languageselect.cpp @@ -34,7 +34,8 @@ LanguageSelect::LanguageSelect(QWidget* parent) : { ui->setupUi(this); if (Application::isDarkTheme()) { - if (QFile f(QStringLiteral(":dark-languageselect.qss")); f.open(QFile::ReadOnly | QFile::Text)) { + if (QFile f(QStringLiteral(":dark-languageselect.qss")); + f.open(QFile::ReadOnly | QFile::Text)) { style()->unpolish(this); setStyleSheet(styleSheet() + QTextStream(&f).readAll()); style()->polish(this); 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 5b5d42a0..fcf6dd51 100644 --- a/src/ui/webeiddialog.cpp +++ b/src/ui/webeiddialog.cpp @@ -113,9 +113,10 @@ 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((currentCommand == CommandType::AUTHENTICATE + && button->certificateInfo().pin1Active) + || button->certificateInfo().pin2Active); } ui->okButton->setFocus(); }); @@ -574,8 +575,9 @@ 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 = (currentCommand == CommandType::AUTHENTICATE && certAndPin.pin1Active) + || certAndPin.pin2Active; setupPinPrompt(certAndPin.pinInfo, cardActive); if (!cardActive) { return; @@ -606,9 +608,10 @@ void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinI void WebEidDialog::setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo) { - ui->lockedWarning->setHidden(certAndPinInfo.cardActive); + setupWarning(certAndPinInfo); setupPinPrompt(certAndPinInfo.pinInfo, - currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.cardActive); + (currentCommand == CommandType::AUTHENTICATE && certAndPinInfo.pin1Active) + || certAndPinInfo.pin2Active); // The allowed character ranges are from the SafeNet eToken guide: // 1. English uppercase letters (ASCII 0x41...0x5A). // 2. English lowercase letters (ASCII 0x61...0x7A). @@ -642,6 +645,26 @@ 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) { + ui->lockedWarning->setText( + tr("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) { + ui->lockedWarning->setText( + tr("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."); }); diff --git a/src/ui/webeiddialog.hpp b/src/ui/webeiddialog.hpp index 0e888ccd..590a009e 100644 --- a/src/ui/webeiddialog.hpp +++ b/src/ui/webeiddialog.hpp @@ -106,6 +106,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);