Skip to content

Commit

Permalink
fix: print cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Urban committed Apr 30, 2024
1 parent c0e7027 commit 833fdf1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/internal/handlers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,22 @@ func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request) {
return
}

var domain string
siteURL, siteUrlErr := h.getRedirectUrl(r, w)
if siteUrlErr != nil {
// If there was an error getting the redirect URL, use the request's host as the domain
log.Println("Site URl could not be determined: " + siteURL)
domain = r.Host
} else {
// If the redirect URL was obtained successfully, extract the main domain
h.setRedirectCookie(siteURL, r, w)
var err error
domain, err = extractMainDomain(r.Host)
if err != nil {
sendJSONError(w, "Invalid Redirect URL", http.StatusBadRequest)
return
}
}
domain, err := extractMainDomain(r.Host)
if err != nil {
slog.Error("could not extract Main Domain", err)
return
Expand Down

0 comments on commit 833fdf1

Please sign in to comment.