dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit bc6846c3e539687bdbee97c449ec2570b16dc76a
parent 7963d88ddcfb030f5087f49770f95c72f023a750
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 14 Dec 2023 03:21:34 -0500

auth middleware to set redirect param for the login mechanism

Diffstat:
Mpkg/web/middlewares/middlewares.go | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/web/middlewares/middlewares.go b/pkg/web/middlewares/middlewares.go @@ -285,7 +285,7 @@ func IsAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc { if strings.HasPrefix(c.Path(), "/api/") { return c.String(http.StatusUnauthorized, "unauthorized") } - return c.Redirect(http.StatusFound, "/") + return c.Redirect(http.StatusFound, "/?redirect="+c.Request().URL.String()) } c.Response().Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")