Skip to content

Commit

Permalink
fix: set user to authenticate
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Urban committed May 1, 2024
1 parent b0a35c6 commit 03d0d92
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/internal/handlers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,17 @@ func (h *Handler) HandleAuthenticate(w http.ResponseWriter, r *http.Request) {
}
slog.Info("Incoming session is authenticated")
sessionUser, ok := session.Values["user"].(string)
slog.Info(sessionUser)
if !ok {
h.logError(w, "error while fetching user details from session", err, http.StatusInternalServerError)
return
}
if sessionUser == "" {
sessionUser = oneTimeStore[token].user
}
if sessionUser == "" {
h.logError(w, "error while fetching user details from session", err, http.StatusInternalServerError)
}
slog.Info(sessionUser)

// Check if the user has the role "admin"
var user models.User
Expand Down

0 comments on commit 03d0d92

Please sign in to comment.