mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 04:22:33 +08:00
fix: 安全登录启用时,可能出现反复跳转登录页的问题
This commit is contained in:
@@ -65,6 +65,7 @@ func MustLogin(t *gotext.Locale, session *sessions.Manager, userToken biz.UserTo
|
||||
ip, _, _ := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr))
|
||||
clientHash := fmt.Sprintf("%x", sha256.Sum256([]byte(ip)))
|
||||
if safeClientHash != clientHash || safeClientHash == "" {
|
||||
sess.Forget("user_id") // 清除 user_id,否则会来回跳转
|
||||
Abort(w, http.StatusUnauthorized, t.Get("client ip/ua changed, please login again"))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user