From ba39d648fd0d6d82208a494db61f1d3dea0f63a6 Mon Sep 17 00:00:00 2001 From: cangui Date: Fri, 9 May 2025 16:51:23 +0200 Subject: [PATCH] JKSDK,,KDS --- backend/routes/routes.go | 12 +++++++++++- frontend/templates/dashboard.pages.tmpl | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/routes/routes.go b/backend/routes/routes.go index 86433a8..5fe3b9f 100644 --- a/backend/routes/routes.go +++ b/backend/routes/routes.go @@ -41,7 +41,17 @@ func RoutesProtected(r *mux.Router, db *gorm.DB) { r.HandleFunc("/test/send2", renders.TestMessagesPages2) r.HandleFunc("/admin/user/{id}/conversation-thread", renders.AdminConversationThread(db)).Methods("GET") r.HandleFunc("/api/message/send2", handlers.HandleTemplateTest(db)).Methods("POST") - + r.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) { + http.SetCookie(w, &http.Cookie{ + Name: "token", + Value: "", + Path: "/", + MaxAge: -1, + HttpOnly: true, + }) + http.Redirect(w, r, "/login", http.StatusSeeOther) + }) + // // Ici on place les vues et API qui doivent être protégées diff --git a/frontend/templates/dashboard.pages.tmpl b/frontend/templates/dashboard.pages.tmpl index 0725de4..dd680c9 100644 --- a/frontend/templates/dashboard.pages.tmpl +++ b/frontend/templates/dashboard.pages.tmpl @@ -12,6 +12,8 @@
  • 📤 Test envoi
  • 📤 Test envoi template
  • {{ end }} + 💬 Mes conversations +