mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(web): redirect to login on expired cookie (#201)
* feat(web): redirect to login on expired cookie * refactor: simplify auth wrapper
This commit is contained in:
parent
baac92cc25
commit
2d3ab67604
4 changed files with 25 additions and 11 deletions
|
@ -9,7 +9,7 @@ func (s Server) IsAuthenticated(next http.Handler) http.Handler {
|
|||
|
||||
// Check if user is authenticated
|
||||
if auth, ok := session.Values["authenticated"].(bool); !ok || !auth {
|
||||
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
|
||||
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue