Files
leanote/app/views/Home/find_password.html
2014-05-07 13:06:24 +08:00

83 lines
2.1 KiB
HTML

{{template "home/header_box.html" .}}
<style>
</style>
<section id="box">
<div>
<h1>leanote | {{msg . "findPassword"}}</h1>
<form class="form-inline" id="boxForm">
<div class="alert alert-danger" id="loginMsg"></div>
<table style="width: 100%">
<tr>
<td style="width: 110px"><label for="email">{{msg . "email"}}</label>
<input type="text" class="form-control" id="email" name="email" value="{{.email}}"> </td>
</tr>
<tr>
<td>
<button id="loginBtn" class="btn btn-success" style="width: 100%">{{msg . "findPassword"}}</button>
</td>
</tr>
</table>
</form>
<div id="quickLinks">
<a href="/login">{{msg . "login"}}</a>
&nbsp;
<a href="/index">{{msg . "home"}}</a>
</div>
</div>
</section>
<script src="/js/jquery-1.9.0.min.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/common.js"></script>
<script>
$(function() {
$("#email").focus();
if($("#email").val()) {
$("#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 email = $("#email").val();
if(!email) {
showMsg("{{msg . "inputEmail"}}", "email");
return;
} else {
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if(!myreg.test(email)) {
showMsg("{{msg . "wrongEmail"}}", "email");
return;
}
}
$("#loginBtn").html("{{msg . "ing"}}...").addClass("disabled");
// hideMsg();
$.post("/doFindPassword", {email: email}, function(e) {
$("#loginBtn").html("{{msg . "findPassword"}}").removeClass("disabled");
if(e.Ok) {
var msg = "{{msg . "findPasswordSendEmailOver"}}";
var loginAddress = getEmailLoginAddress(email);
if(loginAddress) {
msg += ' <a target="_blank" href="' + loginAddress + '">{{msg . "checkEmai"}}</a>';
}
$("#loginMsg").html(msg).show().removeClass("alert-danger").addClass("alert-success");
} else {
showMsg(e.Msg, "email");
}
});
});
});
</script>
</body>
</html>