-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ | |
"config", | ||
"core", | ||
"docs", | ||
"docker", | ||
"models", | ||
"public", | ||
"routes", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
extends ../layout | ||
|
||
block content | ||
.container(style="margin-top:30px;") | ||
form#form.col-md-5.col-md-offset-3(method="post") | ||
.form-group | ||
label.sr-only(for="inputEmail") 邮箱地址/用户名 | ||
input#inputEmail.form-control(type="text" name="account" placeholder="邮箱地址/用户名" required autofocus) | ||
.form-group | ||
.col-md-10(style="margin-left:-15px;") | ||
label.sr-only(for="inputToken") token | ||
input#inputToken.form-control(type="text" name="token" placeholder="token" required) | ||
.col-md-2 | ||
a.form-control.btn.btn-link(style="margin-bottom:15px;" target="_blank" href="/auth/login") 获取token | ||
.form-group | ||
label.sr-only(for="inputPassword") 原密码 | ||
input#inputPassword.form-control(type="password" name="oldPassword" placeholder="原密码" required) | ||
.form-group | ||
label.sr-only(for="inputNewPassword") 新密码 | ||
input#inputNewPassword.form-control(type="password" name="newPassword" placeholder="新密码" required) | ||
.form-group | ||
a#submitBtn.btn.btn-lg.btn-primary.btn-block 修改密码 | ||
|
||
block js | ||
script(). | ||
var submit = false; | ||
$('#submitBtn').on('click', function () { | ||
if (submit) { | ||
return ; | ||
} | ||
var token = $('#inputToken').val(); | ||
var oldPassword = $('#inputPassword').val(); | ||
var newPassword = $('#inputNewPassword').val(); | ||
submit = true; | ||
$.ajax({ | ||
type: 'patch', | ||
data: JSON.stringify({oldPassword:oldPassword,newPassword:newPassword}), | ||
contentType: 'application/json;charset=utf-8', | ||
headers: { | ||
Authorization : 'Bearer '+token | ||
}, | ||
url: '/users/password', | ||
dataType: 'json', | ||
success: function (data) { | ||
if (data.status == "OK") { | ||
alert("修改成功"); | ||
location.href = '/auth/login'; | ||
} else if (data.status == 401) { | ||
alert('token invalid'); | ||
} else { | ||
alert(data.message); | ||
} | ||
submit = false; | ||
} | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters