mirror of
https://gitee.com/mirrors/AllinSSL.git
synced 2026-03-08 15:51:11 +08:00
修复修改账号密码后需要重新从安全入口访问
This commit is contained in:
@@ -27,7 +27,7 @@ func SessionAuthMiddleware() gin.HandlerFunc {
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
gob.Register(time.Time{})
|
gob.Register(time.Time{})
|
||||||
last := session.Get("lastRequestTime")
|
last := session.Get("lastRequestTime")
|
||||||
|
|
||||||
if routePath == public.Secure {
|
if routePath == public.Secure {
|
||||||
if session.Get("secure") == nil {
|
if session.Get("secure") == nil {
|
||||||
// 访问安全入口,设置 session
|
// 访问安全入口,设置 session
|
||||||
@@ -88,9 +88,10 @@ func SessionAuthMiddleware() gin.HandlerFunc {
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if session.Get("__login_key") != public.GetSettingIgnoreError("login_key") {
|
if session.Get("__login_key") != public.GetSettingIgnoreError("login_key") {
|
||||||
session.Clear()
|
session.Set("login", nil)
|
||||||
session.Save()
|
session.Save()
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"message": "登录信息发生变化,请重新登录"})
|
// c.JSON(http.StatusUnauthorized, gin.H{"message": "登录信息发生变化,请重新登录"})
|
||||||
|
c.Redirect(http.StatusFound, "/login")
|
||||||
c.Abort()
|
c.Abort()
|
||||||
} else {
|
} else {
|
||||||
// 访问正常,更新最后请求时间
|
// 访问正常,更新最后请求时间
|
||||||
|
|||||||
Reference in New Issue
Block a user