diff --git a/src/controller/controller.cpp b/src/controller/controller.cpp index 4bbbd9f7..5894e103 100644 --- a/src/controller/controller.cpp +++ b/src/controller/controller.cpp @@ -101,15 +101,6 @@ void Controller::run() startCommandExecution(); - } catch (const std::invalid_argument& exc) { - if (isInStdinMode) { - // Pass invalid argument message to the caller just in case it may be interested - // The result will be {"invalid-argument" : message} - // Command parameter is only used if exception will be raised during json creation - writeResponseToStdOut(isInStdinMode, {{QStringLiteral("invalid-argument"), exc.what()}}, - "invalid-argument"); - } - onCriticalFailure(exc.what()); } catch (const std::exception& error) { onCriticalFailure(error.what()); } diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp index 261319b5..76f7ab75 100644 --- a/src/ui/webeiddialog.cpp +++ b/src/ui/webeiddialog.cpp @@ -20,8 +20,6 @@ * SOFTWARE. */ -#include "utils/erasedata.hpp" - #include "webeiddialog.hpp" #include "application.hpp" #include "punycode.hpp" @@ -292,7 +290,8 @@ QString WebEidDialog::getPin() // QString uses QAtomicPointer internally and is thread-safe. // There should be only single reference and this is transferred to the caller for safety QString ret = pin; - eraseData(pin); + // Cannot use eraseData because we have to force Qt copy-on-write + pin.fill('\0'); pin.clear(); return ret; } @@ -464,7 +463,6 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const break; case Status::PIN_BLOCKED: displayPinBlockedError(); - resizeHeight(); return; case Status::INVALID_PIN_LENGTH: message = [] { return tr("Invalid PIN length"); }; @@ -481,7 +479,7 @@ void WebEidDialog::onVerifyPinFailed(const VerifyPinFailed::Status status, const case Status::UNKNOWN_ERROR: message = [] { return tr("Technical error"); }; displayFatalError(message); - break; + return; } ui->pinErrorLabel->setVisible(bool(message)); @@ -681,17 +679,7 @@ void WebEidDialog::setupOK(Func func, const char* text, bool enabled) void WebEidDialog::displayPinBlockedError() { - ui->pinTitleLabel->hide(); - ui->pinInput->hide(); - ui->pinTimeoutTimer->stop(); - ui->pinTimeRemaining->hide(); - ui->pinEntryTimeoutProgressBar->hide(); - setTrText(ui->pinErrorLabel, QT_TR_NOOP("PIN is locked. Unblock and try again.")); - ui->pinErrorLabel->show(); - ui->okButton->hide(); - ui->cancelButton->setEnabled(true); - ui->cancelButton->show(); - ui->helpButton->show(); + displayFatalError([] { return tr("PIN is locked. Unblock and try again."); }); } void WebEidDialog::displayFatalError(std::function message) @@ -706,6 +694,8 @@ void WebEidDialog::displayFatalError(std::function message) ui->okButton->hide(); ui->cancelButton->setEnabled(true); ui->cancelButton->show(); + ui->helpButton->show(); + resizeHeight(); } void WebEidDialog::showPinInputWarning(bool show)