feat: pagina principal configurable por rol (HomeUrl)
This commit is contained in:
@@ -37,8 +37,12 @@ func LoginPost(c *fiber.Ctx) error {
|
||||
return c.Redirect("/login?error=" + url.QueryEscape(err.Error()))
|
||||
}
|
||||
|
||||
// Si todo está bien, redirige al inicio de la app
|
||||
return c.Redirect("/app/servidor")
|
||||
// Redirige según la página principal del rol, o por defecto a /app/servidor
|
||||
homeUrl := "/app/servidor"
|
||||
if user.Role.HomeUrl != "" {
|
||||
homeUrl = user.Role.HomeUrl
|
||||
}
|
||||
return c.Redirect(homeUrl)
|
||||
}
|
||||
|
||||
var store = session.New()
|
||||
|
||||
@@ -11,7 +11,11 @@ import (
|
||||
|
||||
func RedirectToHomePageOnLogin(c *fiber.Ctx) error {
|
||||
if auth.IsLoggedIn(c) {
|
||||
return c.Redirect("/app/dashboard")
|
||||
user, err := auth.User(c)
|
||||
if err == nil && user != nil && user.Role.HomeUrl != "" {
|
||||
return c.Redirect(user.Role.HomeUrl)
|
||||
}
|
||||
return c.Redirect("/app/servidor")
|
||||
}
|
||||
// Si tiene sesión de portal activa, ir al portal
|
||||
if user, err := auth.PortalUser(c); err == nil && user != nil {
|
||||
|
||||
Reference in New Issue
Block a user