@ -78,7 +78,7 @@ app.get('/sign_up', async (req, res) => {
// Logout
app.get('/logout', async (req, res) => {
req.session.user_id = null;
res.redirect(syzoj.utils.makeUrl());
res.redirect(req.query.url || '/');
});
// User page
@ -9,7 +9,7 @@
<script src="//cdn.bootcss.com/Chart.js/2.4.0/Chart.bundle.min.js"></script>
<script type="text/javascript">
$("#logout").click(function () {
window.location.href = "/logout";
window.location.href = <%- JSON.stringify(syzoj.utils.makeUrl(['logout'], { url: req.originalUrl })) %>;
</script>
</body>
@ -38,12 +38,12 @@
</a>
<% } else { %>
<div class="item">
<div class="ui button" style="margin-right: 0.5em" onclick="window.location.href='/login'">
<a class="ui button" style="margin-right: 0.5em; " href="<%= syzoj.utils.makeUrl(['login'], { url: req.originalUrl }) %>">
登录
</div>
<div class="ui primary button" onclick="window.location.href='/sign_up'">
<a class="ui primary button" href="<%= syzoj.utils.makeUrl(['sign_up'], { url: req.originalUrl }) %>">
注册
<% } %>
@ -48,7 +48,7 @@ function show_error(error) {
$("#error").show();
}
function success(session_id) {
window.location.href = "/";
window.location.href = <%- JSON.stringify(req.query.url || '/') %>;
function login() {
password = md5($("#password").val() + "syzoj2_xxx");
@ -39,7 +39,7 @@ function show_error(error) {
function success() {
alert("注册成功!");
function submit() {
if ($("#password1").val() != $("#password2").val()) {