Skip to content

Commit

Permalink
Ensuring the session is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Oct 7, 2023
1 parent f7c90ab commit 8179b8e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions views/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func (v *Views) RequiresLogin(next echo.HandlerFunc) echo.HandlerFunc {
session, err := v.cookie.Get(c.Request(), v.conf.SessionCookieName)
if err != nil {
log.Printf("failed to get session: %+v", err)
session.Options.MaxAge = -1
err = session.Save(c.Request(), c.Response())
if err != nil {
log.Printf("failed to save session for logout: %+v", err)
}
return c.Redirect(http.StatusFound, "/")
}
c1 := v.getSessionData(c)
Expand Down

0 comments on commit 8179b8e

Please sign in to comment.