From ac4c685b6c7129488ce5a42b24a6f9c7dce4b665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Bouzour=C3=A8ne?= Date: Thu, 23 Jan 2025 15:05:19 +0100 Subject: [PATCH] Logout user if deleted while session active --- middlewares/authentication.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/middlewares/authentication.go b/middlewares/authentication.go index 2a40029..e2de2d7 100644 --- a/middlewares/authentication.go +++ b/middlewares/authentication.go @@ -31,6 +31,11 @@ func AuthMiddleware(c *fiber.Ctx) error { if !active { denyAccess = true + + err = sess.Destroy() + if err != nil { + return err + } } }