mirror of
https://github.com/ehang-io/nps.git
synced 2026-11-03 02:20:50 +08:00
web api
This commit is contained in:
1 parent
f43942413e
commit
efa341c7e8
3 files changed
+8
-3
No files matched your search
@@ -27,7 +27,8 @@ 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) >= -20 && crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key) {
|
||||
timeNowUnix := time.Now().Unix()
|
||||
if !(((timeNowUnix - int64(timestamp)) <= 20) && ((timeNowUnix - int64(timestamp)) >= -20) && (crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key)) {
|
||||
if s.GetSession("auth") != true {
|
||||
s.Redirect("/login/index", 302)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user