-
Notifications
You must be signed in to change notification settings - Fork 50
Show locked card warning #1388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
metsma
wants to merge
1
commit into
master
Choose a base branch
from
courier
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Show locked card warning #1388
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,34 +53,4 @@ enum Actions : unsigned char { | |
| ClearCryptoWarning, | ||
| }; | ||
|
|
||
| enum Pages : unsigned char { | ||
| SignIntro, | ||
| SignDetails, | ||
| CryptoIntro, | ||
| CryptoDetails, | ||
| MyEid | ||
| }; | ||
|
|
||
| enum WarningType : unsigned char { | ||
| NoWarning = 0, | ||
|
|
||
| CertExpiredError, | ||
| CertExpiryWarning, | ||
| UnblockPin1Warning, | ||
| UnblockPin2Warning, | ||
| ActivatePin2Warning, | ||
| ActivatePin1WithPUKWarning, | ||
| ActivatePin2WithPUKWarning, | ||
|
|
||
| InvalidSignatureError, | ||
| InvalidTimestampError, | ||
| UnknownSignatureWarning, | ||
| UnknownTimestampWarning, | ||
| UnsupportedAsicSWarning, | ||
| UnsupportedAsicCadesWarning, | ||
| UnsupportedDDocWarning, | ||
| UnsupportedCDocWarning, | ||
| EmptyFileWarning, | ||
| }; | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -328,13 +328,14 @@ void ContainerPage::transition(CryptoDoc *container, const QSslCertificate &cert | |
| ui->rightPane->addWidget(new AddressItem(std::move(key), AddressItem::Icon, ui->rightPane)); | ||
| } | ||
| if(hasUnsupported) | ||
| emit warning({UnsupportedCDocWarning}); | ||
| emit warning({WarningText::UnsupportedCDocWarning}); | ||
| ui->leftPane->setModel(container->documentModel()); | ||
| updatePanes(container->state()); | ||
| } | ||
|
|
||
| void ContainerPage::transition(DigiDoc* container) | ||
| { | ||
| using enum WarningText::WarningType; | ||
| disconnect(ui->leftPane, &ItemList::removed, container, nullptr); | ||
| connect(ui->leftPane, &ItemList::removed, container, [this, container](int index) { | ||
| deleteConfirm(container, index); | ||
|
|
@@ -386,7 +387,7 @@ void ContainerPage::transition(DigiDoc* container) | |
| }); | ||
|
|
||
| clear(ClearSignatureWarning); | ||
| std::map<ria::qdigidoc4::WarningType, int> errors; | ||
| std::map<WarningText::WarningType, int> errors; | ||
| setHeader(container->fileName()); | ||
| ui->leftPane->init(fileName, QT_TRANSLATE_NOOP("ItemList", "Container files")); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ struct SignatureItem::Private: public Ui::SignatureItem | |
| { | ||
| DigiDocSignature signature; | ||
|
|
||
| ria::qdigidoc4::WarningType error = ria::qdigidoc4::NoWarning; | ||
| WarningText::WarningType error = WarningText::NoWarning; | ||
| QString serial; | ||
| QString roleText; | ||
| }; | ||
|
|
@@ -77,8 +77,9 @@ void SignatureItem::init() | |
| { | ||
| const SslCertificate cert = ui->signature.cert(); | ||
|
|
||
| using enum WarningText::WarningType; | ||
| ui->serial.clear(); | ||
| ui->error = ria::qdigidoc4::NoWarning; | ||
| ui->error = NoWarning; | ||
| QString nameText; | ||
| if(!cert.isNull()) | ||
| { | ||
|
|
@@ -120,12 +121,12 @@ void SignatureItem::init() | |
| case DigiDocSignature::Invalid: | ||
| ui->status->setLabel(QStringLiteral("error")); | ||
| ui->status->setText(isSignature ? tr("Signature is not valid") : tr("Timestamp is not valid")); | ||
| ui->error = isSignature ? ria::qdigidoc4::InvalidSignatureError : ria::qdigidoc4::InvalidTimestampError; | ||
| ui->error = isSignature ? InvalidSignatureError : InvalidTimestampError; | ||
| break; | ||
| case DigiDocSignature::Unknown: | ||
| ui->status->setLabel(QStringLiteral("error")); | ||
| ui->status->setText(isSignature ? tr("Signature is unknown") : tr("Timestamp is unknown")); | ||
| ui->error = isSignature ? ria::qdigidoc4::UnknownSignatureWarning : ria::qdigidoc4::UnknownTimestampWarning; | ||
| ui->error = isSignature ? UnknownSignatureWarning : UnknownTimestampWarning; | ||
| break; | ||
| } | ||
|
|
||
|
|
@@ -183,7 +184,7 @@ bool SignatureItem::eventFilter(QObject *o, QEvent *e) | |
| return Item::eventFilter(o, e); | ||
| } | ||
|
|
||
| ria::qdigidoc4::WarningType SignatureItem::getError() const | ||
| WarningText::WarningType SignatureItem::getError() const | ||
| { | ||
| return ui->error; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ | |
|
|
||
| #include "widgets/Item.h" | ||
|
|
||
| #include "widgets/WarningItem.h" | ||
|
|
||
| class DigiDocSignature; | ||
|
|
||
| class SignatureItem final : public Item | ||
|
|
@@ -31,7 +33,7 @@ class SignatureItem final : public Item | |
| explicit SignatureItem(DigiDocSignature s, QWidget *parent = nullptr); | ||
| ~SignatureItem() final; | ||
|
|
||
| ria::qdigidoc4::WarningType getError() const; | ||
| WarningText::WarningType getError() const; | ||
| void initTabOrder(QWidget *item) final; | ||
| bool isSelfSigned(const QString& cardCode) const; | ||
| QWidget* lastTabWidget() final; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ VerifyCert::VerifyCert(QWidget *parent) | |
| CertificateDetails::showCertificate(c, this, | ||
| pinType == QSmartCardData::Pin1Type ? QStringLiteral("-auth") : QStringLiteral("-sign")); | ||
| }); | ||
| connect(ui->checkCert, &QToolButton::clicked, this, [this]{ | ||
| connect(ui->checkCert, &QToolButton::clicked, this, [this] { | ||
| auto *dlg = WarningDialog::create(this); | ||
| QString readMore = tr("Read more <a href=\"https://www.id.ee/en/article/validity-of-id-card-certificates/\">here</a>."); | ||
| switch(c.validateOnline()) | ||
|
|
@@ -118,17 +118,18 @@ void VerifyCert::update(QSmartCardData::PinType type, const QSmartCardData &data | |
| update(); | ||
| } | ||
|
|
||
| void VerifyCert::update(QSmartCardData::PinType type, const SslCertificate &cert) | ||
| void VerifyCert::update(QSmartCardData::PinType type, SslCertificate cert) | ||
| { | ||
| pinType = type; | ||
| c = cert; | ||
| c = std::move(cert); | ||
| update(); | ||
| } | ||
|
|
||
| void VerifyCert::update() | ||
| { | ||
| if(cardData.isNull() && c.isNull()) | ||
| return clear(); | ||
| bool isLockedCard = !cardData.isNull() && cardData.pinLocked(QSmartCardData::Pin1Type); | ||
| bool isLockedPin = !cardData.isNull() && pinType == QSmartCardData::Pin2Type && cardData.pinLocked(pinType); | ||
| bool isBlockedPin = !cardData.isNull() && cardData.retryCount(pinType) == 0; | ||
| bool isBlockedPuk = !cardData.isNull() && cardData.retryCount(QSmartCardData::PukType) == 0; | ||
|
|
@@ -183,6 +184,9 @@ void VerifyCert::update() | |
| { | ||
| ui->validUntil->setText(tr("Certificate has expired!")); | ||
| ui->validUntil->setLabel(QStringLiteral("error")); | ||
| icon = QStringLiteral(":/images/icon_alert_large_error.svg"); | ||
| ui->info->setLabel(QStringLiteral("error")); | ||
| ui->info->setText(tr("PIN%1 can not be used because the certificate has expired.").arg(pinType)); | ||
| } | ||
| else if(qint64 leftDays = std::max<qint64>(0, QDateTime::currentDateTime().daysTo(c.expiryDate().toLocalTime())); leftDays <= 105 && !c.isNull()) | ||
| { | ||
|
|
@@ -194,18 +198,20 @@ void VerifyCert::update() | |
|
|
||
| ui->changePIN->setText(tr("Change PIN%1").arg(pinType)); | ||
| ui->forgotPinLink->setText(tr("Change with PUK code")); | ||
| ui->changePIN->setHidden((isBlockedPin && isBlockedPuk) || isTempelType); | ||
| ui->changePIN->setHidden(isLockedCard || (isBlockedPin && isBlockedPuk) || isTempelType); | ||
|
|
||
| if(isTempelType) | ||
| { | ||
| ui->info->setLabel({}); | ||
| ui->info->setText(tr("PIN can be changed only using eToken utility")); | ||
| } | ||
| else if(isInvalidCert) | ||
| else if(isLockedCard) | ||
| { | ||
| icon = QStringLiteral(":/images/icon_alert_large_error.svg"); | ||
| ui->info->setLabel(QStringLiteral("error")); | ||
| ui->info->setText(tr("PIN%1 can not be used because the certificate has expired.").arg(pinType)); | ||
| icon = QStringLiteral(":/images/icon_alert_large_warning.svg"); | ||
| ui->info->setLabel(QStringLiteral("warning")); | ||
| ui->info->setText(pinType == QSmartCardData::Pin1Type ? | ||
| tr("The ID-card must be activated in order to authenticate") : | ||
| tr("The ID-card must be activated in order to sign")); | ||
| } | ||
| else if(isBlockedPin) | ||
| { | ||
|
|
@@ -234,9 +240,9 @@ void VerifyCert::update() | |
| if(!icon.isEmpty()) | ||
| ui->nameIcon->load(icon); | ||
|
|
||
| ui->links->setHidden(pinType == QSmartCardData::PukType && (isBlockedPuk || !isPUKReplacable)); // Keep visible in PUK to align fields equaly | ||
| ui->links->setHidden(pinType == QSmartCardData::PukType && ui->changePIN->isHidden()); | ||
| ui->details->setHidden(pinType == QSmartCardData::PukType); | ||
| ui->forgotPinLink->setHidden(pinType == QSmartCardData::PukType || isBlockedPin || isBlockedPuk || isTempelType); | ||
| ui->forgotPinLink->setHidden(pinType == QSmartCardData::PukType || isLockedCard || isBlockedPin || isBlockedPuk || isTempelType); | ||
| ui->checkCert->setHidden(pinType == QSmartCardData::PukType || isInvalidCert); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ class VerifyCert final : public StyledWidget | |
|
|
||
| void clear(); | ||
| void update(QSmartCardData::PinType type, const QSmartCardData &data); | ||
| void update(QSmartCardData::PinType type, const SslCertificate &cert); | ||
| void update(QSmartCardData::PinType type, SslCertificate cert); | ||
|
|
||
| signals: | ||
| void changePinClicked(QSmartCard::PinAction); | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.