From c627618c6141d70d239ab9f554cc7f351165ec37 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 1 Oct 2025 13:30:12 +0300 Subject: [PATCH] Show warning when card requires activation WE2-1114, WE2-1119 Signed-off-by: Raul Metsma --- .github/workflows/cmake-linux-fedora.yml | 2 +- .github/workflows/cmake-linux-ubuntu.yml | 2 +- .github/workflows/cmake-macos.yml | 4 +- .github/workflows/cmake-windows.yml | 36 ++++++++++++------ lib/libelectronic-id | 2 +- src/controller/certandpininfo.hpp | 7 ++-- .../command-handlers/certificatereader.cpp | 31 ++++++++++----- src/ui/certificatewidget.cpp | 8 ++-- src/ui/dialog.ui | 22 +++++++++++ src/ui/translations/cs.ts | 8 ++++ src/ui/translations/de.ts | 10 ++++- src/ui/translations/en.ts | 8 ++++ src/ui/translations/et.ts | 8 ++++ src/ui/translations/fi.ts | 16 ++++++-- src/ui/translations/fr.ts | 12 +++++- src/ui/translations/hr.ts | 16 ++++++-- src/ui/translations/nl.ts | 8 ++++ src/ui/translations/ru.ts | 8 ++++ src/ui/translations/sk.ts | 8 ++++ src/ui/webeiddialog.cpp | 38 +++++++++++++------ src/ui/webeiddialog.hpp | 2 +- 21 files changed, 199 insertions(+), 57 deletions(-) diff --git a/.github/workflows/cmake-linux-fedora.yml b/.github/workflows/cmake-linux-fedora.yml index 11fe1b2f..b9dcf253 100644 --- a/.github/workflows/cmake-linux-fedora.yml +++ b/.github/workflows/cmake-linux-fedora.yml @@ -14,7 +14,7 @@ jobs: container: fedora:${{ matrix.container }} strategy: matrix: - container: [41, 42] + container: [41, 42, 43] steps: - name: Install Deps diff --git a/.github/workflows/cmake-linux-ubuntu.yml b/.github/workflows/cmake-linux-ubuntu.yml index e1e8d413..062e9492 100644 --- a/.github/workflows/cmake-linux-ubuntu.yml +++ b/.github/workflows/cmake-linux-ubuntu.yml @@ -17,7 +17,7 @@ jobs: container: ubuntu:${{matrix.container}} strategy: matrix: - container: ['22.04', '24.04', '25.04'] + container: ['22.04', '24.04', '25.04', '25.10'] arch: ['amd64', 'arm64'] steps: diff --git a/.github/workflows/cmake-macos.yml b/.github/workflows/cmake-macos.yml index cc29f8ea..b08e0ba4 100644 --- a/.github/workflows/cmake-macos.yml +++ b/.github/workflows/cmake-macos.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: submodules: recursive @@ -64,7 +64,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v4 with: - version: 6.9.1 + version: 6.9.3 arch: clang_64 - name: Configure diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 28027a67..95b6b63e 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -6,31 +6,42 @@ env: BUILD_TYPE: RelWithDebInfo BUILD_NUMBER: ${{github.run_number}} CMAKE_BUILD_PARALLEL_LEVEL: 4 + VCPKG_INSTALLED_DIR: ${{ github.workspace }}/build/vcpkg_installed + # Use libelectronic-id vcpkg manifest for dependencies + VCPKG_MANIFEST_DIR: ./lib/libelectronic-id/.github jobs: build: - runs-on: windows-2022 + runs-on: windows-2025 strategy: matrix: arch: [x64, arm64] steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: submodules: recursive + - name: Cache vcpkg + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-${{ matrix.arch }}-${{ hashFiles(format('{0}/vcpkg.json', env.VCPKG_MANIFEST_DIR)) }} + - name: Prepare vcpkg and libraries - uses: lukka/run-vcpkg@v7 + uses: lukka/run-vcpkg@v11 with: - vcpkgArguments: gtest openssl - vcpkgTriplet: ${{matrix.arch}}-windows - vcpkgGitCommitId: 031ad89ce6c575df35a8e58707ad2c898446c63e + vcpkgJsonGlob: ${{ env.VCPKG_MANIFEST_DIR }}/vcpkg.json + runVcpkgInstall: true + env: + VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite + VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch }}-windows - name: Install Qt uses: jurplel/install-qt-action@v4 with: - version: 6.9.1 + version: 6.9.3 arch: ${{ matrix.arch == 'arm64' && 'win64_msvc2022_arm64_cross_compiled' || 'win64_msvc2022_64' }} - name: Setup MS Visual C++ dev env @@ -40,16 +51,17 @@ jobs: - name: Install WiX run: | - dotnet tool install --global wix --version 6.0.1 - wix extension -g add WixToolset.UI.wixext/6.0.1 - wix extension -g add WixToolset.Util.wixext/6.0.1 - wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.1 + dotnet tool install --global wix --version 6.0.2 + wix extension -g add WixToolset.UI.wixext/6.0.2 + wix extension -g add WixToolset.Util.wixext/6.0.2 + wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.2 - name: Configure run: | cmake "-GNinja" -S . -B build ` "-DCMAKE_TOOLCHAIN_FILE=${env:RUNVCPKG_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" ` - "-DCMAKE_BUILD_TYPE=${env:BUILD_TYPE}" + "-DCMAKE_BUILD_TYPE=${env:BUILD_TYPE}" ` + "-DVCPKG_MANIFEST_DIR=${{ env.VCPKG_MANIFEST_DIR }}" - name: Build run: | diff --git a/lib/libelectronic-id b/lib/libelectronic-id index dfb29b8e..e7490d08 160000 --- a/lib/libelectronic-id +++ b/lib/libelectronic-id @@ -1 +1 @@ -Subproject commit dfb29b8eef499507b5ea9858ea61a835e48bf308 +Subproject commit e7490d08ad8ec62c447cafa79684bd6c033dfb97 diff --git a/src/controller/certandpininfo.hpp b/src/controller/certandpininfo.hpp index 9af08570..bd371fb4 100644 --- a/src/controller/certandpininfo.hpp +++ b/src/controller/certandpininfo.hpp @@ -40,10 +40,10 @@ struct PinInfo using PinMinMaxLength = std::pair; using PinRetriesCount = std::pair; - PinMinMaxLength pinMinMaxLength = {0, 0}; - PinRetriesCount pinRetriesCount = {0, -1}; + PinMinMaxLength pinMinMaxLength {0, 0}; + PinRetriesCount pinRetriesCount {0, -1}; bool readerHasPinPad = false; - bool pinIsBlocked = false; + constexpr bool pinIsBlocked() const { return pinRetriesCount.first == 0; } static constexpr int PIN_PAD_PIN_ENTRY_TIMEOUT = pcsc_cpp::PIN_PAD_PIN_ENTRY_TIMEOUT; }; @@ -55,6 +55,7 @@ struct EidCertificateAndPinInfo QSslCertificate certificate {}; CertificateInfo certInfo; PinInfo pinInfo; + bool cardActive = true; }; Q_DECLARE_METATYPE(EidCertificateAndPinInfo) diff --git a/src/controller/command-handlers/certificatereader.cpp b/src/controller/command-handlers/certificatereader.cpp index 42e5a78c..9f294bb4 100644 --- a/src/controller/command-handlers/certificatereader.cpp +++ b/src/controller/command-handlers/certificatereader.cpp @@ -50,7 +50,7 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr auto serialNumber = certificate.subjectInfo(QSslCertificate::SerialNumber).join(' '); // http://www.etsi.org/deliver/etsi_en/319400_319499/31941201/01.01.01_60/en_31941201v010101p.pdf - if (serialNumber.size() > 6 && serialNumber.startsWith(QStringLiteral("PNO")) + if (serialNumber.size() > 6 && serialNumber.startsWith(QLatin1String("PNO")) && serialNumber[5] == '-') serialNumber.remove(0, 6); @@ -61,16 +61,29 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr CertificateInfo certInfo { certificateType, certificate.expiryDate() < QDateTime::currentDateTimeUtc(), certificate.effectiveDate() > QDateTime::currentDateTimeUtc(), std::move(subject)}; - PinInfo pinInfo {certificateType.isAuthentication() ? eid->authPinMinMaxLength() - : eid->signingPinMinMaxLength(), - certificateType.isAuthentication() ? eid->authPinRetriesLeft() - : eid->signingPinRetriesLeft(), - eid->smartcard().readerHasPinPad()}; - if (pinInfo.pinRetriesCount.first == 0) { - pinInfo.pinIsBlocked = true; + auto info = certificateType.isAuthentication() ? eid->authPinInfo() : eid->signingPinInfo(); + PinInfo pinInfo {.pinMinMaxLength = certificateType.isAuthentication() + ? eid->authPinMinMaxLength() + : eid->signingPinMinMaxLength(), + .pinRetriesCount { + info.retryCount, + 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; } - return {eid, std::move(certificateDer), certificate, std::move(certInfo), std::move(pinInfo)}; + return { + .eid = eid, + .certificateBytesInDer = std::move(certificateDer), + .certificate = certificate, + .certInfo = std::move(certInfo), + .pinInfo = std::move(pinInfo), + .cardActive = cardActivated, + }; } } // namespace diff --git a/src/ui/certificatewidget.cpp b/src/ui/certificatewidget.cpp index 5414171b..9699ef16 100644 --- a/src/ui/certificatewidget.cpp +++ b/src/ui/certificatewidget.cpp @@ -112,11 +112,9 @@ void CertificateWidgetInfo::setCertificateInfo(const EidCertificateAndPinInfo& c info->setText(CertificateWidget::tr("%1
Issuer: %2
Valid: %3 to %4%5") .arg(subject, issuer, effectiveDate, expiryDate, warning)); info->parentWidget()->setDisabled(certInfo.notEffective || certInfo.isExpired - || cardCertPinInfo.pinInfo.pinIsBlocked); - if (warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked) { - warnIcon->show(); - warn->show(); - } + || cardCertPinInfo.pinInfo.pinIsBlocked()); + warnIcon->setVisible(warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked()); + warn->setVisible(warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked()); } void CertificateWidgetInfo::languageChange() diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 19bfd744..6d222049 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -211,6 +211,28 @@ height: 24px; 20 + + + + background-color: #FAE7C9; +color: #003168; +font-family: Roboto, Helvetica; +font-size: 14px; +padding: 10px; +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> + + + true + + + true + + + diff --git a/src/ui/translations/cs.ts b/src/ui/translations/cs.ts index 1039c78f..aba348bd 100644 --- a/src/ui/translations/cs.ts +++ b/src/ui/translations/cs.ts @@ -157,6 +157,10 @@ Operation failed Operace se nezdařila + + PIN entry disabled + + Card driver error. Please try again. Chyba ovladače karty. Zkuste to prosím znovu. @@ -193,6 +197,10 @@ Try again Zkuste to znovu + + 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> + + Cancel Zrušit diff --git a/src/ui/translations/de.ts b/src/ui/translations/de.ts index 1475cb5b..594f1cdf 100644 --- a/src/ui/translations/de.ts +++ b/src/ui/translations/de.ts @@ -155,13 +155,17 @@ Operation failed Der Vorgang ist fehlgeschlagen + + PIN entry disabled + + Card driver error. Please try again. Kartentreiberfehler. Bitte versuche es erneut. Card driver error - Kartentreiberfehler. + Kartentreiberfehler An error occurred in the Smart Card service required to use the ID-card. Make sure that the ID-card and the card reader are connected correctly or relaunch the Smart Card service. @@ -191,6 +195,10 @@ Try again Versuch es noch einmal + + 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> + + Cancel Abbrechen diff --git a/src/ui/translations/en.ts b/src/ui/translations/en.ts index 38ec43ac..2a9a35c2 100644 --- a/src/ui/translations/en.ts +++ b/src/ui/translations/en.ts @@ -155,6 +155,10 @@ Operation failed Operation failed + + PIN entry disabled + PIN entry disabled + Card driver error. Please try again. Card driver error. Please try again. @@ -191,6 +195,10 @@ Try again Try again + + 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> + Cancel Cancel diff --git a/src/ui/translations/et.ts b/src/ui/translations/et.ts index 97d7d4df..6c7e13ee 100644 --- a/src/ui/translations/et.ts +++ b/src/ui/translations/et.ts @@ -107,6 +107,10 @@ PIN entry cancelled. PIN-koodi sisestamine katkestati. + + PIN entry disabled + + Launch the Smart Card service Käivita Kiipkaardi teenus @@ -191,6 +195,10 @@ Try again Proovi uuesti + + 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> + ID-kaardiga allkirjastamine ei ole veel võimalik. Allkirjastamiseks tuleb DigiDoc4 rakenduses PIN2-koodi muuta. <a href="https://www.id.ee/artikkel/id-kaardi-pin-ja-puk-koodide-muutmine/">Lisainfo</a> + Cancel Katkesta diff --git a/src/ui/translations/fi.ts b/src/ui/translations/fi.ts index 120ca47e..394b29cc 100644 --- a/src/ui/translations/fi.ts +++ b/src/ui/translations/fi.ts @@ -135,6 +135,10 @@ Operation failed Toiminto epäonnistui + + PIN entry disabled + + Card driver error. Please try again. Kortinlukijan virhe. Yritä uudelleen. @@ -163,6 +167,10 @@ Try again Yritä uudelleen + + 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> + + Cancel Peruuta @@ -177,7 +185,7 @@ https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ - https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ + https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ By signing, I agree to the transfer of my name and personal identification code to the service provider. @@ -257,15 +265,15 @@ The inserted ID-card does not contain a certificate for the requested operation. Please insert an ID-card that supports the requested operation. - Asennettu henkilökortti ei sisällä varmennetta pyydettyä toimintoa varten. Aseta sisään henkilökortti, joka tukee pyydettyä toimintoa. + Asennettu henkilökortti ei sisällä varmennetta pyydettyä toimintoa varten. Aseta sisään henkilökortti, joka tukee pyydettyä toimintoa. Please enter PIN for authentication in the PIN dialog window that opens. - Syötä PIN todennusta varten avautuvaan PIN-valintaikkunaan. + Syötä PIN todennusta varten avautuvaan PIN-valintaikkunaan. Please enter PIN for signing in the PIN dialog window that opens. - Syötä PIN kirjautumista varten avautuvaan PIN-valintaikkunaan. + Syötä PIN kirjautumista varten avautuvaan PIN-valintaikkunaan. EN diff --git a/src/ui/translations/fr.ts b/src/ui/translations/fr.ts index 72220236..e7d5da57 100644 --- a/src/ui/translations/fr.ts +++ b/src/ui/translations/fr.ts @@ -121,7 +121,7 @@ Insert the ID-card - Insérez la Carte ID + Insérez la Carte ID The ID-card was removed from the reader. Please insert the ID-card into the reader. @@ -155,13 +155,17 @@ Operation failed L'opération a échoué + + PIN entry disabled + + Card driver error. Please try again. Erreur de pilote de carte. Veuillez réessayer. Card driver error - Erreur de pilote de carte. + Erreur de pilote de carte An error occurred in the Smart Card service required to use the ID-card. Make sure that the ID-card and the card reader are connected correctly or relaunch the Smart Card service. @@ -191,6 +195,10 @@ Try again Essayer à nouveau + + 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> + + Cancel Annuler diff --git a/src/ui/translations/hr.ts b/src/ui/translations/hr.ts index 8bf5c112..4135ba33 100644 --- a/src/ui/translations/hr.ts +++ b/src/ui/translations/hr.ts @@ -69,6 +69,10 @@ Enter PIN1 for authentication Unos PIN1 za identifikaciju + + 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> + + About Web eID O Web eID @@ -99,7 +103,7 @@ https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ - https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ + https://www.id.ee/en/article/how-to-check-that-your-id-card-reader-is-working/ Time remaining: <b>%1</b> @@ -177,6 +181,10 @@ PIN je unesen neispravno više puta. Preostalo %n pokušaj/a. + + PIN entry disabled + + PIN is locked. Unblock and try again. PIN je zaključan. Odblokirajte ga i pokušajte ponovo. @@ -259,15 +267,15 @@ The inserted ID-card does not contain a certificate for the requested operation. Please insert an ID-card that supports the requested operation. - Umetnuta iskaznica ne sadrži potvrdu za traženu operaciju. Molimo umetnite osobnu iskaznicu koja podržava traženu operaciju. + Umetnuta iskaznica ne sadrži potvrdu za traženu operaciju. Molimo umetnite osobnu iskaznicu koja podržava traženu operaciju. Please enter PIN for authentication in the PIN dialog window that opens. - Unesite PIN za autentifikaciju u dijaloški prozor PIN-a koji se otvara. + Unesite PIN za autentifikaciju u dijaloški prozor PIN-a koji se otvara. Please enter PIN for signing in the PIN dialog window that opens. - Unesite PIN za prijavu u dijaloški prozor PIN-a koji se otvara. + Unesite PIN za prijavu u dijaloški prozor PIN-a koji se otvara. EN diff --git a/src/ui/translations/nl.ts b/src/ui/translations/nl.ts index 643a5cf4..8599fdca 100644 --- a/src/ui/translations/nl.ts +++ b/src/ui/translations/nl.ts @@ -155,6 +155,10 @@ Operation failed Bewerking mislukt + + PIN entry disabled + + Card driver error. Please try again. Fout met kaartstuurprogramma. Probeer het opnieuw. @@ -191,6 +195,10 @@ Try again Probeer opnieuw + + 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> + + Cancel Annuleer diff --git a/src/ui/translations/ru.ts b/src/ui/translations/ru.ts index d0041855..cdab949e 100644 --- a/src/ui/translations/ru.ts +++ b/src/ui/translations/ru.ts @@ -157,6 +157,10 @@ Operation failed Операция не удалась + + PIN entry disabled + + Card driver error. Please try again. Ошибка драйвера карты. Пожалуйста, попробуйте еще раз. @@ -193,6 +197,10 @@ Try again Попробуйте еще раз + + 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> + Подписание с помощью ID-карты ещё невозможно. Чтобы подписывать, необходимо изменить PIN2 в приложении DigiDoc4. <a href="https://www.id.ee/ru/artikkel/poryadok-izmeneniya-pin-kodov-i-puk-koda-id-karty/">Дополнительная информация</a> + Cancel Прервать diff --git a/src/ui/translations/sk.ts b/src/ui/translations/sk.ts index 5fa57401..e0a75986 100644 --- a/src/ui/translations/sk.ts +++ b/src/ui/translations/sk.ts @@ -157,6 +157,10 @@ Operation failed Operácia zlyhala + + PIN entry disabled + + Card driver error. Please try again. Chyba ovládača karty. Skúste to prosím znova. @@ -193,6 +197,10 @@ Try again Skúste to znova + + 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> + + Cancel Zrušiť diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp index 91bc5bed..4f381ed8 100644 --- a/src/ui/webeiddialog.cpp +++ b/src/ui/webeiddialog.cpp @@ -70,6 +70,7 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private) // close() deletes the dialog automatically if the Qt::WA_DeleteOnClose flag is set. setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); + ui->lockedWarning->hide(); if (Application::isDarkTheme()) { QFile f(QStringLiteral(":dark.qss")); if (f.open(QFile::ReadOnly | QFile::Text)) { @@ -119,7 +120,10 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private) menu->setObjectName("langMenu"); auto* layout = new QGridLayout(menu); layout->setContentsMargins(1, 1, 1, 1); - layout->setSpacing(1); + layout->setHorizontalSpacing(1); +#ifndef Q_OS_DARWIN + layout->setVerticalSpacing(1); +#endif layout->setSizeConstraint(QLayout::SetFixedSize); auto* langGroup = new QButtonGroup(menu); langGroup->setExclusive(true); @@ -164,6 +168,11 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private) connect(ui->selectionGroup, qOverload(&QButtonGroup::buttonClicked), this, [this] { 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); + } ui->okButton->setFocus(); }); connect(ui->cancelButton, &QPushButton::clicked, this, &WebEidDialog::reject); @@ -426,7 +435,7 @@ void WebEidDialog::onSingleCertificateReady(const QUrl& origin, return; } - if (certAndPinInfo.pinInfo.pinIsBlocked) { + if (certAndPinInfo.pinInfo.pinIsBlocked()) { displayPinBlockedError(); } else if (certAndPinInfo.certInfo.isExpired || certAndPinInfo.certInfo.notEffective) { ui->pinTitleLabel->hide(); @@ -525,7 +534,7 @@ bool WebEidDialog::event(QEvent* event) } break; case QEvent::Resize: - ui->langButton->move(width() - ui->langButton->width() - 20, 5); + ui->langButton->move(width() - ui->langButton->width() - 20, ui->pageStack->pos().y() - 20); break; default: break; @@ -602,13 +611,14 @@ void WebEidDialog::setupCertificateAndPinInfo( } } -void WebEidDialog::setupPinPrompt(PinInfo pinInfo) +void WebEidDialog::setupPinPrompt(PinInfo pinInfo, bool cardActive) { - ui->okButton->setHidden(pinInfo.readerHasPinPad); - ui->cancelButton->setHidden(pinInfo.readerHasPinPad); - ui->pinInput->setHidden(pinInfo.readerHasPinPad); - ui->pinTimeRemaining->setVisible(pinInfo.readerHasPinPad); - ui->pinEntryTimeoutProgressBar->setVisible(pinInfo.readerHasPinPad); + ui->okButton->setHidden(pinInfo.readerHasPinPad || !cardActive); + ui->cancelButton->setHidden(pinInfo.readerHasPinPad && cardActive); + ui->pinTitleLabel->setVisible(cardActive); + ui->pinInput->setHidden(pinInfo.readerHasPinPad || !cardActive); + ui->pinTimeRemaining->setVisible(pinInfo.readerHasPinPad && cardActive); + ui->pinEntryTimeoutProgressBar->setVisible(pinInfo.readerHasPinPad && cardActive); bool showPinError = pinInfo.pinRetriesCount.second != -1 && pinInfo.pinRetriesCount.first != pinInfo.pinRetriesCount.second; ui->pinErrorLabel->setVisible(showPinError); @@ -623,7 +633,12 @@ void WebEidDialog::setupPinPrompt(PinInfo pinInfo) void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinInfo& certAndPin) { - setupPinPrompt(certAndPin.pinInfo); + ui->lockedWarning->setHidden(certAndPin.cardActive); + bool cardActive = currentCommand == CommandType::AUTHENTICATE || certAndPin.cardActive; + setupPinPrompt(certAndPin.pinInfo, cardActive); + if (!cardActive) { + return; + } hide(); setWindowFlag(Qt::WindowCloseButtonHint, false); show(); @@ -650,7 +665,8 @@ void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinI void WebEidDialog::setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo) { - setupPinPrompt(certAndPinInfo.pinInfo); + ui->lockedWarning->setHidden(certAndPinInfo.cardActive); + setupPinPrompt(certAndPinInfo.pinInfo, currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.cardActive); // The allowed character ranges are from the SafeNet eToken guide: // 1. English uppercase letters (ASCII 0x41...0x5A). // 2. English lowercase letters (ASCII 0x61...0x7A). diff --git a/src/ui/webeiddialog.hpp b/src/ui/webeiddialog.hpp index 956e7066..0e888ccd 100644 --- a/src/ui/webeiddialog.hpp +++ b/src/ui/webeiddialog.hpp @@ -101,7 +101,7 @@ class WebEidDialog final : public WebEidUI void setTrText(QWidget* label, Text text) const; void setupCertificateAndPinInfo(const std::vector& cardCertAndPinInfos); - void setupPinPrompt(PinInfo pinInfo); + void setupPinPrompt(PinInfo pinInfo, bool cardActive); void setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinInfo& certAndPinInfo); void setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo); template