Merge branch 'loki-47-6F-64:master' into master

This commit is contained in:
GuanZhang 2021-08-09 11:42:02 +09:00 committed by GitHub
commit 13e57bb183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -13,11 +13,11 @@
</div>
<div class="mb-2">
<label for="" class="form-label">Password: </label>
<input type="password" class="form-control" v-model="passwordData.newPassword">
<input type="password" class="form-control" v-model="passwordData.newPassword" required>
</div>
<div class="mb-2">
<label for="" class="form-label">Password: </label>
<input type="password" class="form-control" v-model="passwordData.confirmNewPassword">
<input type="password" class="form-control" v-model="passwordData.confirmNewPassword" required>
</div>
<button class="mb-2 btn btn-primary" style="margin: 1em auto;">Login</button>
<div class="alert alert-danger" v-if="error"><b>Error: </b>{{error}}</div>

View File

@ -419,8 +419,8 @@ void savePassword(resp_https_t response, req_https_t request) {
auto username = inputTree.count("currentUsername") > 0 ? inputTree.get<std::string>("currentUsername") : "";
auto newUsername = inputTree.get<std::string>("newUsername");
auto password = inputTree.count("currentPassword") > 0 ? inputTree.get<std::string>("currentPassword") : "";
auto newPassword = inputTree.get<std::string>("newPassword");
auto confirmPassword = inputTree.get<std::string>("confirmNewPassword");
auto newPassword = inputTree.count("newPassword") > 0 ? inputTree.get<std::string>("newPassword") : "";
auto confirmPassword = inputTree.count("confirmNewPassword") > 0 ? inputTree.get<std::string>("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 {