mirror of https://github.com/qwqdanchun/nps.git
Web api timestamp
This commit is contained in:
parent
24bd9ce6ba
commit
f43942413e
|
@ -27,7 +27,7 @@ func (s *BaseController) Prepare() {
|
|||
md5Key := s.GetString("auth_key")
|
||||
timestamp := s.GetIntNoErr("timestamp")
|
||||
configKey := beego.AppConfig.String("auth_key")
|
||||
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) >= -20 && crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key) {
|
||||
if s.GetSession("auth") != true {
|
||||
s.Redirect("/login/index", 302)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue