1
0

fix: 更新延迟session_token

This commit is contained in:
TsMask
2023-10-19 14:47:56 +08:00
parent f1393c2dd9
commit 4652a124ca
2 changed files with 9 additions and 3 deletions

View File

@@ -14,7 +14,13 @@ import (
func SessionToken(username, sourceAddr string) bool {
token, _ := redis.Get("", "session_token")
if token != "" {
return true
se, err := dborm.XormUpdateSessionShakeTime(token)
if se.AccountId != username || err != nil {
// 过期时间单位秒 配置1800是半小时
expireTime := time.Duration(int64(libConfig.GetExpiresFromConfig())) * time.Second
redis.SetByExpire("", "session_token", token, expireTime)
return true
}
}
token = oauth.GenRandToken("omc") // Generate new token to session ID