fix(ui): allow case-insensitive username (#1249)

This commit is contained in:
ReenigneArcher 2023-05-06 08:45:35 -04:00 committed by GitHub
parent f21b1951b4
commit 91460f3c72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,7 +128,7 @@ namespace confighttp {
auto password = authData.substr(index + 1);
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string();
if (username != config::sunshine.username || hash != config::sunshine.password) {
if (!boost::iequals(username, config::sunshine.username) || hash != config::sunshine.password) {
return false;
}
@ -631,7 +631,7 @@ namespace confighttp {
}
else {
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string();
if (config::sunshine.username.empty() || (username == config::sunshine.username && hash == config::sunshine.password)) {
if (config::sunshine.username.empty() || (boost::iequals(username, config::sunshine.username) && hash == config::sunshine.password)) {
if (newPassword.empty() || newPassword != confirmPassword) {
outputTree.put("status", false);
outputTree.put("error", "Password Mismatch");