Web api bug

pull/103/head V0.17.3
刘河 2019-03-05 13:27:02 +08:00
parent 149b2e467c
commit d45bc3c066
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ func (s *BaseController) Prepare() {
md5Key := s.GetString("auth_key") md5Key := s.GetString("auth_key")
timestamp := s.GetIntNoErr("timestamp") timestamp := s.GetIntNoErr("timestamp")
configKey := beego.AppConfig.String("authKey") 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 { if s.GetSession("auth") != true {
s.Redirect("/login/index", 302) s.Redirect("/login/index", 302)
} }