diff options
| author | Bobby <[email protected]> | 2026-03-07 15:09:42 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-07 15:09:42 +0530 |
| commit | 8f8d41413ff775b6d721059783a0e2de4f90f50c (patch) | |
| tree | 40923d049ee7df8b0bc90d74373c94cdd4d8b230 /utils/auth | |
| parent | 41926c10ea2e8496ce4b528262f5047ccbe6f155 (diff) | |
| download | dove-8f8d41413ff775b6d721059783a0e2de4f90f50c.tar.xz dove-8f8d41413ff775b6d721059783a0e2de4f90f50c.zip | |
feat: add configuration management and server setup
- Implemented configuration file creation and loading in config.go.
- Added default configuration content embedded in embed.go.
- Introduced logging middleware for HTTP requests.
- Created Makefile for build and setup automation.
- Integrated Tailwind CSS and HTMX for frontend styling and interactivity.
- Developed basic authentication flow with login and dashboard pages.
- Enhanced error handling and user feedback in templates.
- Updated dependencies in go.mod and go.sum.
Diffstat (limited to 'utils/auth')
| -rw-r--r-- | utils/auth/auth.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/auth/auth.go b/utils/auth/auth.go index 5abb496..b3d322c 100644 --- a/utils/auth/auth.go +++ b/utils/auth/auth.go @@ -1,6 +1,7 @@ package auth import ( + "dove/config" "dove/session" "github.com/gofiber/fiber/v2" @@ -17,12 +18,11 @@ func IsAuthenticated(context *fiber.Ctx) bool { func RequireAuthentication(handler fiber.Handler) fiber.Handler { return func(context *fiber.Ctx) error { - switch IsAuthenticated(context) { - case true: + if !config.AuthEnabled || IsAuthenticated(context) { return handler(context) - default: - return fiber.ErrUnauthorized } + + return fiber.ErrUnauthorized } } |
