diff options
| author | Bobby <[email protected]> | 2026-03-29 22:52:46 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-03-29 22:52:46 +0530 |
| commit | 9eb9b7f4bd552a641235764f66483e1f940fcfd9 (patch) | |
| tree | da520b923b5e6758d5457b6233dd6671fc640914 /nexus/controllers/auth/logout.go | |
| parent | 65a143a0871c35989b7c7ea6723d39a0585c089e (diff) | |
| download | echoes-of-vaelun-main.tar.xz echoes-of-vaelun-main.zip | |
Diffstat (limited to 'nexus/controllers/auth/logout.go')
| -rw-r--r-- | nexus/controllers/auth/logout.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nexus/controllers/auth/logout.go b/nexus/controllers/auth/logout.go new file mode 100644 index 0000000..f4c7014 --- /dev/null +++ b/nexus/controllers/auth/logout.go @@ -0,0 +1,20 @@ +package auth
+
+import (
+ "nexus/sessions"
+ "nexus/utils/collections"
+ "nexus/utils/meta"
+ "nexus/utils/shortcuts"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func Logout(context *fiber.Ctx) error {
+ sess := meta.Session(context)
+ if err := sessions.DestroySession(sess); err != nil {
+ return shortcuts.RedirectWithFlash(context, "account", collections.Record[string, any]{
+ "Error": ErrSessionDestroy,
+ })
+ }
+ return shortcuts.Redirect(context, "login")
+}
|
