aboutsummaryrefslogtreecommitdiff
path: root/controllers/auth
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 03:06:23 +0530
committerBobby <[email protected]>2026-03-08 03:06:23 +0530
commitcaf265e7050edefa64ecf7e13828ec9636bce867 (patch)
tree6bb8554dbb34695a74c2dca556bf512998cf62ab /controllers/auth
parentcca905d35412f1549400fc3d1aca6dc704d8cae6 (diff)
downloaddove-caf265e7050edefa64ecf7e13828ec9636bce867.tar.xz
dove-caf265e7050edefa64ecf7e13828ec9636bce867.zip
Refactor configuration handling and add mail management features
- Removed dependency on messages package in TOML loading and parsing. - Introduced new config constants and messages for better clarity and maintainability. - Implemented mail user and mailbox management with corresponding controllers and views. - Added new templates for mailboxes, mailbox creation, and user management. - Enhanced logging and error handling throughout the application. - Established a structured approach for applying default values in TOML configuration. - Created new utility functions for SMTP and email handling.
Diffstat (limited to 'controllers/auth')
-rw-r--r--controllers/auth/auth.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/controllers/auth/auth.go b/controllers/auth/auth.go
new file mode 100644
index 0000000..8140ddd
--- /dev/null
+++ b/controllers/auth/auth.go
@@ -0,0 +1,32 @@
+package auth
+
+import (
+ authService "dove/services/auth"
+ "dove/utils/meta"
+ "dove/utils/shortcuts"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func Login(context *fiber.Ctx) error {
+ body, parseError := meta.Body[authService.LoginRequest](context)
+ if parseError != nil {
+ return shortcuts.BadRequestError(context, parseError)
+ }
+
+ _, serviceError := authService.Authenticate(context, body)
+ if serviceError != nil {
+ return shortcuts.HandleError(context, serviceError)
+ }
+
+ return shortcuts.Redirect(context, "dashboard.index")
+}
+
+func Logout(context *fiber.Ctx) error {
+ _, serviceError := authService.Deauthenticate(context)
+ if serviceError != nil {
+ return shortcuts.HandleError(context, serviceError)
+ }
+
+ return shortcuts.Redirect(context, "home")
+} \ No newline at end of file