diff options
| author | Bobby <[email protected]> | 2025-12-19 18:01:24 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2025-12-19 18:01:24 +0530 |
| commit | b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24 (patch) | |
| tree | 7080b7dc97522ffe0837a1e0b2965489d7e67664 /utils/auth/auth.go | |
| parent | 767297e28d47ee9cf3722054e41caa837f0e68d2 (diff) | |
| download | lain-b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24.tar.xz lain-b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24.zip | |
added utils, templates, routes, types, middleware, processors and a whole lot of things for a basic login page
Diffstat (limited to 'utils/auth/auth.go')
| -rw-r--r-- | utils/auth/auth.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/auth/auth.go b/utils/auth/auth.go new file mode 100644 index 0000000..3a45ac3 --- /dev/null +++ b/utils/auth/auth.go @@ -0,0 +1,17 @@ +package auth + +import ( + session "lain/sessions" + + "github.com/gofiber/fiber/v2" +) + +func IsAuthenticated(context *fiber.Ctx) bool { + session, err := session.Store.Get(context) + if err != nil { + return false + } + + email := session.Get("email") + return email != nil +} |
