diff --git a/assets/web/welcome.html b/assets/web/welcome.html index 8dd40a83..5570de50 100644 --- a/assets/web/welcome.html +++ b/assets/web/welcome.html @@ -13,11 +13,11 @@
- +
- +
Error: {{error}}
diff --git a/sunshine/confighttp.cpp b/sunshine/confighttp.cpp index 97f2f04b..3e624809 100644 --- a/sunshine/confighttp.cpp +++ b/sunshine/confighttp.cpp @@ -419,8 +419,8 @@ void savePassword(resp_https_t response, req_https_t request) { auto username = inputTree.count("currentUsername") > 0 ? inputTree.get("currentUsername") : ""; auto newUsername = inputTree.get("newUsername"); auto password = inputTree.count("currentPassword") > 0 ? inputTree.get("currentPassword") : ""; - auto newPassword = inputTree.get("newPassword"); - auto confirmPassword = inputTree.get("confirmNewPassword"); + auto newPassword = inputTree.count("newPassword") > 0 ? inputTree.get("newPassword") : ""; + auto confirmPassword = inputTree.count("confirmNewPassword") > 0 ? inputTree.get("confirmNewPassword") : ""; if(newUsername.length() == 0) newUsername = username; if(newUsername.length() == 0){ outputTree.put("status", false); @@ -428,7 +428,7 @@ void savePassword(resp_https_t response, req_https_t request) { } 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(newPassword != confirmPassword) { + if(newPassword.empty() || newPassword != confirmPassword) { outputTree.put("status", false); outputTree.put("error", "Password Mismatch"); } else {