Show message when user needs to touch their YubiKey (still buggy when using multiple databases)

This commit is contained in:
Janek Bevendorff 2017-02-24 03:25:08 +01:00
parent 44ac7d152b
commit d6c48a5cf1
No known key found for this signature in database
GPG key ID: CFEC2F6850BFFA53
11 changed files with 75 additions and 16 deletions

View file

@ -214,6 +214,8 @@ CompositeKey DatabaseOpenWidget::databaseKey()
bool blocking = i & true;
int slot = i >> 1;
auto key = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot, blocking));
connect(key.data(), SIGNAL(userInteractionRequired()), SLOT(showYubiKeyPopup()));
connect(key.data(), SIGNAL(userConfirmed()), SLOT(hideYubiKeyPopup()));
masterKey.addChallengeResponseKey(key);
}
#endif
@ -264,6 +266,18 @@ void DatabaseOpenWidget::pollYubikey()
QtConcurrent::run(YubiKey::instance(), &YubiKey::detect);
}
void DatabaseOpenWidget::showYubiKeyPopup()
{
m_ui->messageWidget->showMessage(tr("Please touch the button on your YubiKey!"), MessageWidget::Information);
KEEPASSXC_MAIN_WINDOW->setEnabled(false);
}
void DatabaseOpenWidget::hideYubiKeyPopup()
{
m_ui->messageWidget->hideMessage();
KEEPASSXC_MAIN_WINDOW->setEnabled(true);
}
void DatabaseOpenWidget::yubikeyDetected(int slot, bool blocking)
{
YkChallengeResponseKey yk(slot, blocking);