Allow setting URLs in the widget (for config) and fix "salt" generation
This commit is contained in:
		
					parent
					
						
							
								8493f036ba
							
						
					
				
			
			
				commit
				
					
						98577bbcb8
					
				
			
		
					 2 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
					@ -130,9 +130,9 @@ void DanbooruConnectWidget::getWalletData()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        QString hashedPassword;
 | 
					        QString hashedPassword;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        hashedPassword = boardSalts.value(m_boardUrl);
 | 
					        hashedPassword = boardSalts.value(key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        hashedPassword = hashedPassword.arg(hashedPassword ,valueMap[QLatin1String("password")]);
 | 
					        hashedPassword = hashedPassword.arg(valueMap[QLatin1String("password")]);
 | 
				
			||||||
        hashedPassword = QCryptographicHash::hash(hashedPassword.toUtf8(),
 | 
					        hashedPassword = QCryptographicHash::hash(hashedPassword.toUtf8(),
 | 
				
			||||||
                         QCryptographicHash::Sha1).toHex();
 | 
					                         QCryptographicHash::Sha1).toHex();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,6 +154,16 @@ void DanbooruConnectWidget::toggleLineEdits(int state)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DanbooruConnectWidget::setBoards(const QVector<QUrl> &urlList) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    danbooruUrlComboBox->clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (auto item : urlList) {
 | 
				
			||||||
 | 
					        danbooruUrlComboBox->insertUrl(urlList.indexOf(item), item);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DanbooruConnectWidget::emitRejected()
 | 
					void DanbooruConnectWidget::emitRejected()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Q_EMIT rejected();
 | 
					    Q_EMIT rejected();
 | 
				
			||||||
| 
						 | 
					@ -192,7 +202,7 @@ void DanbooruConnectWidget::accept()
 | 
				
			||||||
        if (m_password.isEmpty()) {
 | 
					        if (m_password.isEmpty()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            hashedPassword = boardSalts.value(m_boardUrl);
 | 
					            hashedPassword = boardSalts.value(m_boardUrl);
 | 
				
			||||||
            hashedPassword = hashedPassword.arg(hashedPassword, passwdLineEdit->text());
 | 
					            hashedPassword = hashedPassword.arg(passwdLineEdit->text());
 | 
				
			||||||
            hashedPassword = QCryptographicHash::hash(hashedPassword.toUtf8(),
 | 
					            hashedPassword = QCryptographicHash::hash(hashedPassword.toUtf8(),
 | 
				
			||||||
                            QCryptographicHash::Sha1).toHex();
 | 
					                            QCryptographicHash::Sha1).toHex();
 | 
				
			||||||
            m_password = hashedPassword;
 | 
					            m_password = hashedPassword;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,6 +53,7 @@ public:
 | 
				
			||||||
    QString password() const;
 | 
					    QString password() const;
 | 
				
			||||||
    QUrl boardUrl() const;
 | 
					    QUrl boardUrl() const;
 | 
				
			||||||
    bool isAnonymous() const;
 | 
					    bool isAnonymous() const;
 | 
				
			||||||
 | 
					    void setBoards(const QVector<QUrl> &urlList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    QUrl  m_boardUrl;
 | 
					    QUrl  m_boardUrl;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue