From b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24 Mon Sep 17 00:00:00 2001 From: Bobby <30593201+luciferreeves@users.noreply.github.com> Date: Fri, 19 Dec 2025 18:01:24 +0530 Subject: added utils, templates, routes, types, middleware, processors and a whole lot of things for a basic login page --- middleware/auth.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 middleware/auth.go (limited to 'middleware/auth.go') diff --git a/middleware/auth.go b/middleware/auth.go new file mode 100644 index 0000000..baa67fb --- /dev/null +++ b/middleware/auth.go @@ -0,0 +1,15 @@ +package middleware + +import ( + "lain/utils/auth" + "lain/utils/shortcuts" + + "github.com/gofiber/fiber/v2" +) + +func authentication(context *fiber.Ctx) error { + if !auth.IsAuthenticated(context) { + return shortcuts.Redirect(context, "auth.login") + } + return context.Next() +} -- cgit v1.2.3