signout
This commit is contained in:
@@ -158,6 +158,13 @@ func SessionsItemDelete(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Write([]byte("404 - Not Found"))
|
w.Write([]byte("404 - Not Found"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果目标 ssession_id 和当前 session_id 相同, 则清除 Cookie
|
||||||
|
if sessionx.ID == session.ID {
|
||||||
|
cookie := http.Cookie{Name: "session_id", Value: "", Path: "/", HttpOnly: true, MaxAge: -1}
|
||||||
|
http.SetCookie(w, &cookie)
|
||||||
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
w.Write(utils.ToJSON(sessionx))
|
w.Write(utils.ToJSON(sessionx))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user