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
+2 -2
View File
@@ -128,7 +128,7 @@ namespace confighttp {
auto password = authData.substr(index + 1); auto password = authData.substr(index + 1);
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string(); 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; return false;
} }
@@ -631,7 +631,7 @@ namespace confighttp {
} }
else { else {
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string(); 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) { if (newPassword.empty() || newPassword != confirmPassword) {
outputTree.put("status", false); outputTree.put("status", false);
outputTree.put("error", "Password Mismatch"); outputTree.put("error", "Password Mismatch");