From 70ccd49d04837dfbb0b5e9cb0c087d55d9f71f15 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sun, 15 Feb 2015 22:10:58 +0100 Subject: [PATCH] Fix a few errors in board URL retrieval Some functions accessed an empty QString (m_boardUrl) because it was not yet filled at the time, breaking logic elsewhere. This is now fixed. --- src/danbooruconnectwidget.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/danbooruconnectwidget.cpp b/src/danbooruconnectwidget.cpp index 3b235a7..41e365f 100644 --- a/src/danbooruconnectwidget.cpp +++ b/src/danbooruconnectwidget.cpp @@ -186,13 +186,14 @@ QString DanbooruConnectWidget::password() const } void DanbooruConnectWidget::accept() + { - QString hashedPassword; + QString currentBoard = danbooruUrlComboBox->currentText(); if (!userLineEdit->text().isEmpty() && !passwdLineEdit->text().isEmpty()) { - if (m_wallet && !m_wallet->hasEntry(m_boardUrl.url())) { + if (m_wallet && !m_wallet->hasEntry(currentBoard)) { QMap dataMap; dataMap.insert(QLatin1String("username"), m_username); dataMap.insert(QLatin1String("password"), passwdLineEdit->text()); @@ -202,8 +203,8 @@ void DanbooruConnectWidget::accept() // Only calculate if we haven't set a password from the wallet already if (m_password.isEmpty()) { - hashedPassword = boardSalts.value(m_boardUrl); - hashedPassword = hashedPassword.arg(passwdLineEdit->text()); + QString hashedPassword = boardSalts.value(danbooruUrlComboBox->currentText()); + hashedPassword = hashedPassword.arg(currentBoard); hashedPassword = QCryptographicHash::hash(hashedPassword.toUtf8(), QCryptographicHash::Sha1).toHex(); m_password = hashedPassword;