Fix mutex lock issue in user cache preventing login

This commit is contained in:
2024-05-02 09:20:04 +07:00
parent a2295bc560
commit 6eab8517dc
2 changed files with 21 additions and 26 deletions

View File

@ -69,11 +69,13 @@ func Auth(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, req)
return
case session.Unauthorized:
http.SetCookie(w, &http.Cookie{
Name: "redirect",
Value: r.RequestURI,
Path: "/",
})
if r.RequestURI != "/logout" {
http.SetCookie(w, &http.Cookie{
Name: "redirect",
Value: r.RequestURI,
Path: "/",
})
}
http.Redirect(w, r, "/signin", http.StatusSeeOther)
return
case session.InvalidSession: