From d8c4180a373be4f29ff3adbd234efefc76b4f6c2 Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Thu, 2 Sep 2021 09:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=82=E3=80=82=E3=80=82?= =?UTF-8?q?=E3=80=82=E8=AF=B7=E5=8B=BF=E6=8B=89=E5=8F=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/account.go | 4 +++- theme/admin.html | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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); }