diff --git a/backend/main.go b/backend/main.go index 937462b..1a7653e 100644 --- a/backend/main.go +++ b/backend/main.go @@ -64,11 +64,11 @@ func PasswordGenerator(passwordLength int) string { } func register(res http.ResponseWriter, req *http.Request) { - cookie, _ := req.Cookie("heimdall") - // It won't throw any error. - // The service will be protected by heimdall - // Hence if this endpoint is being triggered then - // It means that cookie has to be present + cookie, err := req.Cookie("heimdall") + if err != nil { + http.Error(res, "No Heimdall session token received", http.StatusUnauthorized) + return + } tokenString := cookie.Value // Get email from JWT