wide/view/login.html

98 lines
3.5 KiB
HTML
Raw Normal View History

2014-09-21 16:31:36 +04:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{.i18n.wide}} - {{.i18n.login}}</title>
2014-10-10 12:04:59 +04:00
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/login.css?{{.conf.StaticResourceVersion}}">
2014-10-12 18:00:26 +04:00
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
2014-09-21 16:31:36 +04:00
</head>
<body>
2014-10-10 12:04:59 +04:00
<div class="header">
<div class="wrapper fn-clear">
2014-10-12 18:00:26 +04:00
<a href="/login">
<img src="{{.conf.StaticServer}}/static/images/wide-logo.png"
class="logo"/></a>
2014-10-10 12:04:59 +04:00
<ul class="fn-right">
2014-10-10 12:49:31 +04:00
<li><a href="https://github.com/b3log/wide" target="_blank">GitHub</a></li>
<li><a href="https://www.gitbook.io/book/88250/wide-user-guide" target="_blank">{{.i18n.help}}</a></li>
<li><a href="https://github.com/b3log/wide/issues/new" target="_blank">{{.i18n.report_issues}}</a></li>
2014-10-10 12:04:59 +04:00
</ul>
</div>
</div>
<div class="content">
<div class="wrapper fn-clear">
<div class="fn-left">
<h2>Hello, 世界</h2>
<h3>Coding with Go on the Wide way.</h3>
</div>
<div class="form fn-right">
<div id="msg" class="fn-none"></div>
<input id="username" placeholder="{{.i18n.username}}"/><br/>
<input id="password" type="password" placeholder="{{.i18n.password}}..."/><br/>
</div>
</div>
</div>
<div class="footer">
<div class="wrapper">
2014-10-10 12:49:31 +04:00
Ver {{.ver}}, &copy; 2014 <a href="http://b3log.org" target="_blank">B3LOG.ORG</a>
2014-10-10 12:04:59 +04:00
</div>
</div>
2014-09-21 17:49:13 +04:00
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
2014-09-21 16:31:36 +04:00
<script type="text/javascript">
2014-10-10 12:04:59 +04:00
(function () {
2014-10-10 18:12:56 +04:00
var contentH = $(window).height() - $(".footer").height() - $(".header").height() - 18;
2014-10-10 12:04:59 +04:00
$(".content").height(contentH)
.css("padding-top", (contentH - $(".content .fn-left").height()) / 2 + "px");
var login = function () {
var request = {
username: $("#username").val(),
password: $("#password").val()
};
$.ajax({
type: 'POST',
url: '/login',
data: JSON.stringify(request),
dataType: "json",
success: function (data) {
if (!data.succ) {
$("#msg").text('{{.i18n.login_failed}}').show();
return;
}
2014-09-21 17:49:13 +04:00
2014-10-10 12:04:59 +04:00
window.location.href = "/";
}
});
};
2014-09-21 17:49:13 +04:00
2014-10-10 12:04:59 +04:00
$("#username").keydown(function (event) {
if (event.which === 13) {
if ($.trim($(this).val()) === "") {
$("#msg").text("{{.i18n.login_failed}}").show();
} else {
$("#password").focus();
}
} else {
$("#msg").hide();
}
}).focus();
2014-09-21 17:49:13 +04:00
2014-09-21 16:31:36 +04:00
2014-10-10 12:04:59 +04:00
$("#password").keydown(function (event) {
if (event.which === 13) {
if ($.trim($(this).val()) === "") {
$("#msg").text("{{.i18n.login_failed}}").show();
} else {
login();
2014-09-21 16:31:36 +04:00
}
2014-10-10 12:04:59 +04:00
} else {
$("#msg").hide();
}
});
})();
2014-09-21 16:31:36 +04:00
</script>
</body>
</html>