mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 22:20:53 +03:00
Don't overwrite WebUI password when changing preferences
The input field to change password does not contain the actual password, but its hash. When the preferences are saved, the hashed password is considered as a new password. Prevent this by comparing the new password with the hash of the previous password. Closes #2241.
This commit is contained in:
parent
60bc22119d
commit
ef0b4c6ee2
1 changed files with 4 additions and 0 deletions
|
@ -958,6 +958,10 @@ QString Preferences::getWebUiPassword() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setWebUiPassword(const QString &new_password) {
|
void Preferences::setWebUiPassword(const QString &new_password) {
|
||||||
|
// Do not overwrite current password with its hash
|
||||||
|
if (new_password == getWebUiPassword())
|
||||||
|
return;
|
||||||
|
|
||||||
// Encode to md5 and save
|
// Encode to md5 and save
|
||||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||||
md5.addData(new_password.toLocal8Bit());
|
md5.addData(new_password.toLocal8Bit());
|
||||||
|
|
Loading…
Reference in a new issue