summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-07 23:21:40 -0600
committermo khan <mo@mokhan.ca>2025-05-07 23:21:40 -0600
commite09da8c213b5919e318e822de7f0e6d74e76d05c (patch)
tree7ff664c3d9cc620b8180459067e1e95c07aa952e /app
parentdd33572c6bc554019c052e7281d4d5269b7b4986 (diff)
feat: check if cookie is valid
Diffstat (limited to 'app')
-rw-r--r--app/controllers/sessions/controller.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/sessions/controller.go b/app/controllers/sessions/controller.go
index 6948473..fdda36d 100644
--- a/app/controllers/sessions/controller.go
+++ b/app/controllers/sessions/controller.go
@@ -139,10 +139,15 @@ func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {
return
}
- cookie.Write(w, web.NewCookie("session", encoded,
+ err = web.WriteCookie(w, web.NewCookie("session", encoded,
cookie.WithSameSite(http.SameSiteLaxMode),
cookie.WithExpiration(tokens.Expiry),
))
+ if err != nil {
+ pls.LogError(r.Context(), err)
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
http.Redirect(w, r, "/dashboard", http.StatusFound)
}