diff options
| author | Bobby <[email protected]> | 2025-12-22 13:46:50 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2025-12-22 13:46:50 +0530 |
| commit | 32ee8047eba06c9f1c7575b66fc0f9195657ac04 (patch) | |
| tree | ed781e7b05aeba0b5db78e69918edd6a0928c9e1 /router | |
| parent | f17d9142781eb1a659ea53311d9225b244ad209c (diff) | |
| download | lain-32ee8047eba06c9f1c7575b66fc0f9195657ac04.tar.xz lain-32ee8047eba06c9f1c7575b66fc0f9195657ac04.zip | |
auth engine, basic login working
Diffstat (limited to 'router')
| -rw-r--r-- | router/auth.go | 3 | ||||
| -rw-r--r-- | router/mail.go | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/router/auth.go b/router/auth.go index 8c13e37..728e985 100644 --- a/router/auth.go +++ b/router/auth.go @@ -10,4 +10,7 @@ func init() { urls.SetNamespace("auth") urls.Path(types.GET, "/login", controllers.LoginPage, "login") + urls.Path(types.GET, "/logout", controllers.Logout, "logout") + + urls.Path(types.POST, "/login", controllers.Login, "login.submit") } diff --git a/router/mail.go b/router/mail.go new file mode 100644 index 0000000..8584f05 --- /dev/null +++ b/router/mail.go @@ -0,0 +1,19 @@ +package router + +import ( + "lain/session" + "lain/types" + "lain/utils/auth" + "lain/utils/urls" + + "github.com/gofiber/fiber/v2" +) + +func init() { + urls.SetNamespace("mail") + + urls.Path(types.GET, "/inbox", auth.RequireAuthentication(func(c *fiber.Ctx) error { + email, _ := session.GetSessionEmail(c) + return c.SendString("Inbox for " + email) + }), "inbox") +} |
