diff --git a/controllers/account.go b/controllers/account.go index 888f0aa..a90631b 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -77,5 +77,7 @@ func (c *AccountController) Admin() { } func (c *AccountController) IsAdmin() { - c.SetSession("pin", "test") + var pin = c.GetString("pin") + c.SetSession("pin", pin) + c.Ctx.WriteString("登录") } diff --git a/theme/admin.html b/theme/admin.html index e30393e..72f06f3 100644 --- a/theme/admin.html +++ b/theme/admin.html @@ -106,10 +106,9 @@ } } } - xmlhttp.open("GET", "/api/login/query", true); - xmlhttp.send(); - sessionStorage.setItem('pin',document.getElementById("pin").value); - window.location.href = "/admin" + xmlhttp.open("POST","/admin", true); + xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded") + xmlhttp.send("pin="+userName); }