Added functionality to user page

This commit is contained in:
2024-04-26 15:45:54 +07:00
parent fd2d4a35fb
commit 769bffe6ff
9 changed files with 186 additions and 64 deletions

View File

@ -75,6 +75,7 @@ func Auth(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
return
}
storeSession, err := session.Store.Get(cookie.Value)
if err != nil {
if errors.Is(err, &session.SessionNotFound{}) {
storeSession.Destroy(w)
@ -87,6 +88,7 @@ func Auth(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
}
userSession := GetUser(storeSession)
if userSession.Authenticated {
session.GetSessionInfo(storeSession.Values["user"].(types.User).Email, cookie.Value).UpdateAccessTime()
next.ServeHTTP(w, r)
return
}