mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-09 08:53:28 +08:00
修改 LoginStatus 用 context 传递
This commit is contained in:
@@ -109,7 +109,9 @@ func DeleteCookie(w http.ResponseWriter, name string) {
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
func CreateSession(w http.ResponseWriter, r *http.Request, authSession *AuthSession) {
|
||||
lockManager.LoginStatus.Store(loginStatusKey, true) // 更新登录成功状态
|
||||
// lockManager.LoginStatus.Store(loginStatusKey, true) // 更新登录成功状态
|
||||
hc := r.Context().Value(loginStatusKey).(*HttpContext)
|
||||
hc.LoginStatus = true
|
||||
|
||||
cr := authSession.ClientRequest
|
||||
ua := authSession.UserActLog
|
||||
@@ -201,7 +203,9 @@ func LinkAuth_otp(w http.ResponseWriter, r *http.Request) {
|
||||
// http.Error(w, "TooManyError, please login again", http.StatusBadRequest)
|
||||
// return
|
||||
// }
|
||||
lockManager.LoginStatus.Store(loginStatusKey, false) // 记录登录失败状态
|
||||
// lockManager.LoginStatus.Store(loginStatusKey, false) // 记录登录失败状态
|
||||
hc := r.Context().Value(loginStatusKey).(*HttpContext)
|
||||
hc.LoginStatus = false
|
||||
|
||||
base.Warn("OTP 动态码错误", username, r.RemoteAddr)
|
||||
ua.Info = "OTP 动态码错误"
|
||||
|
Reference in New Issue
Block a user