This commit is contained in:
Lizandro Guarnizo
2026-05-16 13:44:32 -05:00
parent 85595e639e
commit 76a0c28b16
16 changed files with 225 additions and 725 deletions
+1 -3
View File
@@ -7,13 +7,11 @@ import (
)
// PortalAuth protege las rutas del portal de clientes.
// Si no hay sesión válida, destruye la sesión obsoleta y redirige a /portal/login.
// Si no hay sesión activa, redirige a /portal/login.
func PortalAuth() fiber.Handler {
return func(c *fiber.Ctx) error {
user, err := auth.PortalUser(c)
if err != nil || user == nil {
// Limpiar sesión inválida/obsoleta para romper posibles redirect loops
_ = auth.DestroyPortalSession(c)
return c.Redirect("/portal/login")
}
c.Locals("portalUser", user)