Files
leanote/app/views/home/find_password.html
lealife 032470c3df v 2.2
2016-12-24 15:47:57 +08:00

88 lines
2.1 KiB
HTML

{{template "home/header_box.html" .}}
<section id="box" class="animated fadeInUp">
<div>
<h1 id="logo"></h1>
<div id="boxForm">
<div id="boxHeader">{{msg . "findPassword"}}</div>
<form>
<div class="alert alert-danger" id="loginMsg"></div>
<div class="form-group">
<label class="control-label" for="email">{{msg . "email"}}</label>
<input type="text" class="form-control" id="email" name="email" value="{{.email}}">
</div>
<button id="loginBtn" class="btn btn-success">{{msg . "findPassword"}}</button>
</form>
</div>
</div>
</section>
<div id="boxFooter">
<p>
<a href="/login">{{msg . "login"}}</a>
&nbsp;
<a href="/index">{{msg . "home"}}</a>
</p>
<p>
© <a href="https://leanote.com">Leanote</a>
</p>
</div>
<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>