wide/views/login.html

126 lines
4.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{.i18n.wide}} - {{.i18n.wide_title}}</title>
<meta name="keywords" content="Wide, Golang, IDE, Team, Cloud, B3log, Login"/>
<meta name="description" content="A Web-based IDE for Teams using Golang, do your development anytime, anywhere."/>
<meta name="author" content="B3log">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/sign.css?{{.conf.StaticResourceVersion}}">
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<div class="header">
<div class="wrapper fn-clear">
<a href="/login" rel="login">
<img title="Wide, a Web-based IDE for Teams using Golang." src="{{.conf.StaticServer}}/static/images/wide-logo.png"
class="logo"/></a>
<ul class="fn-right">
<li><a href="/playground" target="_blank" style="color: #cd504a">Play</a></li>
<li><a rel="bookmark" href="https://github.com/b3log/wide" target="_blank">GitHub</a></li>
<li><a href="http://pan.baidu.com/s/1dD3XwOT" target="_blank">{{.i18n.download}}</a></li>
<li><a rel="help" href="https://www.gitbook.io/book/88250/wide-user-guide" target="_blank">{{.i18n.help}}</a></li>
<li><a rel="bookmark" href="https://github.com/b3log/wide/issues/new" target="_blank">{{.i18n.issues}}</a></li>
<li><button class="btn btn-red" onclick="window.open('http://b3log.org/services')">{{.i18n.pricing}}</button></li>
<li><button class="btn" onclick="window.location.href = '/signup'">{{.i18n.sign_up}}</button></li>
</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="Username"/><br/>
<input id="password" type="password" placeholder="Password"/><br/>
<button id="loginBtn" class="btn-white btn">{{.i18n.login}}</button>
</div>
</div>
</div>
<div class="footer">
<div class="wrapper">
Ver {{.ver}}, &copy; {{.year}} <a rel="copyright" href="http://b3log.org" target="_blank">B3LOG.ORG</a>, <a href="https://github.com/b3log/wide/blob/master/TERMS.md" target="_blank">{{.i18n.terms}}</a>
</div>
</div>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
(function () {
var contentH = $(window).height() - $(".footer").height() - $(".header").height() - 18;
$(".content").height(contentH)
.css("padding-top", (contentH - $(".content .fn-left").height()) / 2 + "px");
var login = function () {
var username = $.trim($("#username").val());
var password = $.trim($("#password").val());
if (username === "") {
$("#msg").text("{{.i18n.login_error}}").show();
$("#username").focus();
return false;
} else if (password === "") {
$("#msg").text("{{.i18n.login_error}}").show();
$("#password").focus();
return false;
}
var request = {
username: username,
password: password
};
$.ajax({
type: 'POST',
url: '/login',
data: JSON.stringify(request),
dataType: "json",
success: function (data) {
if (!data.succ) {
$("#msg").text('{{.i18n.login_error}}').show();
return;
}
window.location.href = "/";
}
});
};
$("#username").keydown(function (event) {
if (event.which === 13) {
if ($.trim($(this).val()) === "") {
$("#msg").text("{{.i18n.login_error}}").show();
} else {
$("#password").focus();
}
} else {
$("#msg").hide();
}
}).focus();
$("#password").keydown(function (event) {
if (event.which === 13) {
if ($.trim($(this).val()) === "") {
$("#msg").text("{{.i18n.login_error}}").show();
} else {
login();
}
} else {
$("#msg").hide();
}
});
$("#loginBtn").click(function () {
login();
});
})();
</script>
</body>
</html>