aboutsummaryrefslogtreecommitdiff
path: root/controllers/logout.go
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/logout.go')
-rw-r--r--controllers/logout.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/controllers/logout.go b/controllers/logout.go
index 20c280d..58ff545 100644
--- a/controllers/logout.go
+++ b/controllers/logout.go
@@ -1,8 +1,8 @@
package controllers
import (
+ "imageboard/config"
"imageboard/session"
- "imageboard/utils/auth"
"github.com/gofiber/fiber/v2"
)
@@ -10,7 +10,7 @@ import (
func LogoutController(ctx *fiber.Ctx) error {
sess, err := session.Store.Get(ctx)
if err != nil {
- return ctx.Redirect(auth.GetRedirectURL(ctx), fiber.StatusSeeOther)
+ return ctx.Redirect(config.URL_HOME, fiber.StatusSeeOther)
}
if err := sess.Destroy(); err != nil {
@@ -19,5 +19,10 @@ func LogoutController(ctx *fiber.Ctx) error {
sess.Save()
}
- return ctx.Redirect(auth.GetRedirectURL(ctx), fiber.StatusSeeOther)
+ next := ctx.Query("next")
+ if next != "" {
+ return ctx.Redirect(next, fiber.StatusSeeOther)
+ }
+
+ return ctx.Redirect(config.URL_HOME, fiber.StatusSeeOther)
}