Optimize session retrieval and fix Docker timezone issue
This commit is contained in:
@ -59,10 +59,13 @@ func Handler(next http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
func Auth(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
|
||||
status, user := session.GetSession(r)
|
||||
status, user, sessionID := session.GetSession(r)
|
||||
|
||||
switch status {
|
||||
case session.Authorized:
|
||||
userSession := session.GetSessionInfo(user.Email, sessionID)
|
||||
userSession.UpdateAccessTime()
|
||||
|
||||
ctx := context.WithValue(r.Context(), "user", user)
|
||||
req := r.WithContext(ctx)
|
||||
r.Context().Value("user")
|
||||
@ -94,7 +97,7 @@ func Auth(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func Guest(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) {
|
||||
status, _ := session.GetSession(r)
|
||||
status, _, _ := session.GetSession(r)
|
||||
|
||||
switch status {
|
||||
case session.Authorized:
|
||||
|
Reference in New Issue
Block a user