99 lines
2.2 KiB
HTML
99 lines
2.2 KiB
HTML
{{template "home/header_box.html" .}}
|
|
<section id="box">
|
|
<div>
|
|
<h1>leanote | {{msg . "updatePassword"}}</h1>
|
|
<form class="form-inline" id="boxForm">
|
|
<div class="form-group">
|
|
</div>
|
|
<div class="alert alert-danger" id="loginMsg"> </div>
|
|
|
|
<table style="width: 100%">
|
|
<tr>
|
|
<td style="width: 350px"><label for="email">{{msg . "email"}}</label>
|
|
<br />
|
|
{{.findPwd.Email}}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="pwd">{{msg . "password"}}</label>
|
|
<input type="password" class="form-control" id="pwd" name="pwd">
|
|
{{msg . "passwordTips"}}
|
|
</td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="pwd2">{{msg . "password2"}}</label>
|
|
<input type="password" class="form-control" id="pwd2" name="pwd2">
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<button id="loginBtn" class="btn btn-success" style="width: 100%">{{msg . "updatePassword"}}</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
<script src="/js/jquery-1.9.0.min.js"></script>
|
|
<script src="/js/bootstrap.js"></script>
|
|
|
|
<script>
|
|
|
|
$(function() {
|
|
$("#pwd").focus();
|
|
function showMsg(msg, id) {
|
|
$("#loginMsg").html(msg).show();
|
|
if(id) {
|
|
$("#" + id).focus();
|
|
}
|
|
}
|
|
function hideMsg() {
|
|
$("#loginMsg").hide();
|
|
}
|
|
$("#loginBtn").click(function(e){
|
|
e.preventDefault();
|
|
|
|
var pwd = $("#pwd").val();
|
|
var pwd2 = $("#pwd2").val();
|
|
|
|
if(!pwd) {
|
|
showMsg("{{msg . "inputPassword"}}", "pwd");
|
|
return;
|
|
} else {
|
|
if(pwd.length < 6) {
|
|
showMsg("{{msg . "notGoodPassword"}}", "pwd");
|
|
return;
|
|
}
|
|
}
|
|
if(!pwd2) {
|
|
showMsg("{{msg . "inputPassword2"}}", "pwd2");
|
|
return;
|
|
} else {
|
|
if(pwd != pwd2) {
|
|
showMsg("{{msg . "confirmPassword"}}", "pwd2");
|
|
return;
|
|
}
|
|
}
|
|
|
|
$("#loginBtn").html("{{msg . "ing"}}...").addClass("disabled");
|
|
// hideMsg();
|
|
|
|
$.post("/findPasswordUpdate", {pwd: pwd, token: "{{.findPwd.Token}}"}, function(e) {
|
|
$("#loginBtn").html("{{msg . "updatePassword"}}").removeClass("disabled");
|
|
if(e.Ok) {
|
|
$("#loginBtn").html("{{msg . "updatePasswordSuccessRedirectToLogin"}}");
|
|
location.href = "/login?email={{.findPwd.Email}}";
|
|
} else {
|
|
showMsg(e.Msg, "pwd");
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |