diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index aff4186278..5da349de95 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -339,18 +339,18 @@ QSharedPointer DatabaseOpenWidget::buildDatabaseKey() // try to retrieve the stored password using Windows Hello QByteArray keyData; #ifdef Q_CC_MSVC - if (!getWindowsHello()->getKey(m_filename, keyData)) { - // Failed to retrieve Quick Unlock data - m_ui->messageWidget->showMessage(tr("Failed to authenticate with Windows Hello"), MessageWidget::Error); - return {}; - } + const auto keyDataOk = getWindowsHello()->getKey(m_filename, keyData); + const auto errorString = tr("Failed to authenticate with Windows Hello"); #elif defined(Q_OS_MACOS) - if (!TouchID::getInstance().getKey(m_filename, keyData)) { + const auto keyDataOk = TouchID::getInstance().getKey(m_filename, keyData); + const auto errorString = tr("Failed to authenticate with Touch ID"); +#endif + if (!keyDataOk) { // Failed to retrieve Quick Unlock data - m_ui->messageWidget->showMessage(tr("Failed to authenticate with Touch ID"), MessageWidget::Error); + m_ui->messageWidget->showMessage(errorString, MessageWidget::Error); + resetQuickUnlock(); return {}; } -#endif databaseKey->setRawKey(keyData); return databaseKey; }