Skip to content

Commit 43d98aa

Browse files
committed
Show courier delivered cards warning when card is not activated
WE2-1182 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 9aa2099 commit 43d98aa

20 files changed

Lines changed: 118 additions & 76 deletions

‎src/controller/certandpininfo.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ struct EidCertificateAndPinInfo
5555
QSslCertificate certificate {};
5656
CertificateInfo certInfo;
5757
PinInfo pinInfo;
58-
bool cardActive = true;
58+
bool pin1Active = true;
59+
bool pin2Active = true;
5960
};
6061

6162
Q_DECLARE_METATYPE(EidCertificateAndPinInfo)

‎src/controller/command-handlers/certificatereader.cpp‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace electronic_id;
3131
namespace
3232
{
3333

34-
EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr& eid,
34+
EidCertificateAndPinInfo getCertificateWithStatusAndInfo(ElectronicID::ptr&& eid,
3535
const CertificateType certificateType)
3636
{
3737
const auto certificateBytes = eid->getCertificate(certificateType);
@@ -70,19 +70,23 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr
7070
info.maxRetry,
7171
},
7272
.readerHasPinPad = eid->smartcard().readerHasPinPad()};
73-
bool cardActivated = info.pinActive;
74-
if (certificateType == CertificateType::AUTHENTICATION && eid->type() == ElectronicID::EstEID
75-
&& eid->name() == "EstEIDThales") {
76-
cardActivated = eid->signingPinInfo().pinActive;
73+
bool pin1Active = true;
74+
bool pin2Active = true;
75+
if (eid->type() == ElectronicID::EstEID && eid->name() == "EstEIDThales") {
76+
auto infoOther =
77+
certificateType.isAuthentication() ? eid->signingPinInfo() : eid->authPinInfo();
78+
pin1Active = certificateType.isAuthentication() ? info.pinActive : infoOther.pinActive;
79+
pin2Active = certificateType.isAuthentication() ? infoOther.pinActive : info.pinActive;
7780
}
7881

7982
return {
80-
.eid = eid,
83+
.eid = std::move(eid),
8184
.certificateBytesInDer = std::move(certificateDer),
8285
.certificate = certificate,
8386
.certInfo = std::move(certInfo),
8487
.pinInfo = std::move(pinInfo),
85-
.cardActive = cardActivated,
88+
.pin1Active = pin1Active,
89+
.pin2Active = pin2Active,
8690
};
8791
}
8892

@@ -96,7 +100,7 @@ CertificateReader::CertificateReader(const CommandWithArguments& cmd) : CommandH
96100
}
97101
}
98102

99-
void CertificateReader::run(const std::vector<ElectronicID::ptr>& eids)
103+
void CertificateReader::run(std::vector<ElectronicID::ptr>&& eids)
100104
{
101105
REQUIRE_NOT_EMPTY_CONTAINS_NON_NULL_PTRS(eids)
102106

@@ -105,9 +109,10 @@ void CertificateReader::run(const std::vector<ElectronicID::ptr>& eids)
105109

106110
std::vector<EidCertificateAndPinInfo> certAndPinInfos;
107111
certAndPinInfos.reserve(eids.size());
108-
for (const auto& eid : eids) {
112+
for (auto& eid : eids) {
109113
try {
110-
certAndPinInfos.push_back(getCertificateWithStatusAndInfo(eid, certificateType));
114+
certAndPinInfos.push_back(
115+
getCertificateWithStatusAndInfo(std::move(eid), certificateType));
111116
} catch (const WrongCertificateTypeError&) {
112117
// Ignore eIDs that don't support the given ceritifcate type.
113118
}

‎src/controller/command-handlers/certificatereader.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CertificateReader : public CommandHandler
3333
public:
3434
explicit CertificateReader(const CommandWithArguments& cmd);
3535

36-
void run(const std::vector<electronic_id::ElectronicID::ptr>& eids) override;
36+
void run(std::vector<electronic_id::ElectronicID::ptr>&& eids) override;
3737
void connectSignals(const WebEidUI* window) override;
3838

3939
protected:

‎src/controller/commandhandler.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CommandHandler : public QObject
3333
public:
3434
using ptr = std::unique_ptr<CommandHandler>;
3535

36-
virtual void run(const std::vector<electronic_id::ElectronicID::ptr>& eids) = 0;
36+
virtual void run(std::vector<electronic_id::ElectronicID::ptr>&& eids) = 0;
3737
virtual void connectSignals(const WebEidUI* window) = 0;
3838
virtual QVariantMap onConfirm(WebEidUI* window,
3939
const EidCertificateAndPinInfo& certAndPinInfo) = 0;

‎src/controller/qeid.hpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@
2828

2929
Q_DECLARE_METATYPE(electronic_id::AutoSelectFailed::Reason)
3030
Q_DECLARE_METATYPE(electronic_id::ElectronicID::ptr)
31-
Q_DECLARE_METATYPE(std::vector<electronic_id::ElectronicID::ptr>)
3231
Q_DECLARE_METATYPE(electronic_id::VerifyPinFailed::Status)

‎src/controller/threads/commandhandlerrunthread.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CommandHandlerRunThread : public ControllerChildThread
3939
}
4040

4141
private:
42-
void doRun() override { commandHandler.run(eids); }
42+
void doRun() override { commandHandler.run(std::move(eids)); }
4343

4444
CommandHandler& commandHandler;
4545
std::vector<electronic_id::ElectronicID::ptr> eids;

‎src/ui/dialog.ui‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<string notr="true">QWidget {
2424
background-color: white;
2525
font-size: 14px;
26-
font-family: &quot;Roboto&quot;;
26+
font-family: Roboto, Helvetica;
2727
color: black;
2828
}
2929
QPushButton {
@@ -46,14 +46,19 @@ color: white;
4646
border-color: #2F70B6;
4747
background-color: #2F70B6;
4848
}
49-
QPushButton::default:hover, #helpButton:hover {
49+
QPushButton::default:hover, QPushButton::default:focus,
50+
#helpButton:hover, #helpButton:focus {
5051
border-color: #2B66A6;
5152
background-color: #2B66A6;
5253
}
5354
QPushButton::default:pressed, #helpButton:pressed {
5455
border-color: #215081;
5556
background-color: #215081;
5657
}
58+
QPushButton:default:disabled {
59+
border-color: #82A9D3;
60+
background-color: #82A9D3;
61+
}
5762
#langButton {
5863
color: #003168;
5964
border: 0px;
@@ -182,7 +187,7 @@ border: none;
182187
border-radius: 4px;</string>
183188
</property>
184189
<property name="text">
185-
<string>Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. &lt;a href=&quot;https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/&quot;&gt;Additional information&lt;/a&gt;</string>
190+
<string notr="true">Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. &lt;a href=&quot;https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/&quot;&gt;Additional information&lt;/a&gt;</string>
186191
</property>
187192
<property name="wordWrap">
188193
<bool>true</bool>

‎src/ui/translations/cs.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,13 @@
184184
<translation>Operace se nezdařila</translation>
185185
</message>
186186
<message>
187-
<source>PIN entry disabled</source>
187+
<source>Authentication and signing with the ID-card isn&apos;t possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. &lt;a href=&quot;https://www.politsei.ee/en/self-service-portal&quot;&gt;Activate ID-card&lt;/a&gt;</source>
188188
<translation type="unfinished"></translation>
189189
</message>
190+
<message>
191+
<source>PIN entry disabled</source>
192+
<translation>Zadávání PINu je zakázáno</translation>
193+
</message>
190194
<message>
191195
<source>Card driver error. Please try again.</source>
192196
<translation>Chyba ovladače karty. Zkuste to prosím znovu.</translation>
@@ -308,10 +312,6 @@
308312
<comment>Active language</comment>
309313
<translation>CS</translation>
310314
</message>
311-
<message>
312-
<source>PIN entry disabled</source>
313-
<translation>Zadávání PINu je zakázáno.</translation>
314-
</message>
315315
<message>
316316
<source>English</source>
317317
<comment>Active language accessible</comment>

‎src/ui/translations/de.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,13 @@
182182
<translation>Der Vorgang ist fehlgeschlagen</translation>
183183
</message>
184184
<message>
185-
<source>PIN entry disabled</source>
185+
<source>Authentication and signing with the ID-card isn&apos;t possible yet. ID-card must be activated in the Police and Border Guard Board’s self-service portal in order to use it. &lt;a href=&quot;https://www.politsei.ee/en/self-service-portal&quot;&gt;Activate ID-card&lt;/a&gt;</source>
186186
<translation type="unfinished"></translation>
187187
</message>
188+
<message>
189+
<source>PIN entry disabled</source>
190+
<translation>PIN-Eingabe deaktiviert</translation>
191+
</message>
188192
<message>
189193
<source>Card driver error. Please try again.</source>
190194
<translation>Kartentreiberfehler. Bitte versuche es erneut.</translation>
@@ -306,10 +310,6 @@
306310
<comment>Active language</comment>
307311
<translation>DE</translation>
308312
</message>
309-
<message>
310-
<source>PIN entry disabled</source>
311-
<translation>PIN-Eingabe deaktiviert.</translation>
312-
</message>
313313
<message>
314314
<source>English</source>
315315
<comment>Active language accessible</comment>

0 commit comments

Comments
 (0)