From d45bc3c066732caf312b421d70f59c381f3b9822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B2=B3?= Date: Tue, 5 Mar 2019 13:27:02 +0800 Subject: [PATCH] Web api bug --- web/controllers/base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/controllers/base.go b/web/controllers/base.go index 636676a..b7bea71 100755 --- a/web/controllers/base.go +++ b/web/controllers/base.go @@ -27,7 +27,7 @@ func (s *BaseController) Prepare() { md5Key := s.GetString("auth_key") timestamp := s.GetIntNoErr("timestamp") configKey := beego.AppConfig.String("authKey") - if !(time.Now().Unix()-int64(timestamp) < 20 && time.Now().Unix()-int64(timestamp) > 0 && crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key) { + if !(time.Now().Unix()-int64(timestamp) <= 20 && time.Now().Unix()-int64(timestamp) >= 0 && crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key) { if s.GetSession("auth") != true { s.Redirect("/login/index", 302) }