mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-28 12:40:33 +00:00
Merge pull request #153 from TheElixZammuto/password-validation
Welcome: Password Validation
This commit is contained in:
commit
17bcdd7902
@ -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>
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user