diff options
| author | Bobby <[email protected]> | 2025-12-15 14:28:13 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2025-12-15 14:28:13 +0530 |
| commit | e143ba0b4a0fff8448124d86bb94e07742aa0a9b (patch) | |
| tree | 0dce19e2122b60c6a9e1a338fa884ba206be561c /controllers/logout.go | |
| parent | 5f6e383d3799d39036842e00ae3149be7fafe188 (diff) | |
| download | imageboard-main.tar.xz imageboard-main.zip | |
Diffstat (limited to 'controllers/logout.go')
| -rw-r--r-- | controllers/logout.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/controllers/logout.go b/controllers/logout.go deleted file mode 100644 index 58ff545..0000000 --- a/controllers/logout.go +++ /dev/null @@ -1,28 +0,0 @@ -package controllers - -import ( - "imageboard/config" - "imageboard/session" - - "github.com/gofiber/fiber/v2" -) - -func LogoutController(ctx *fiber.Ctx) error { - sess, err := session.Store.Get(ctx) - if err != nil { - return ctx.Redirect(config.URL_HOME, fiber.StatusSeeOther) - } - - if err := sess.Destroy(); err != nil { - sess.Delete("user_id") - sess.Delete("username") - sess.Save() - } - - next := ctx.Query("next") - if next != "" { - return ctx.Redirect(next, fiber.StatusSeeOther) - } - - return ctx.Redirect(config.URL_HOME, fiber.StatusSeeOther) -} |
