diff --git a/handlers/auth.go b/handlers/auth.go index 1d2e490..71e7e9c 100644 --- a/handlers/auth.go +++ b/handlers/auth.go @@ -55,7 +55,12 @@ func Login(db *gorm.DB) gin.HandlerFunc { return } - c.Redirect(http.StatusFound, "/admin") + // Redirect based on user role: admins to /admin, others to home + if user.Role == models.RoleAdmin { + c.Redirect(http.StatusFound, "/admin") + } else { + c.Redirect(http.StatusFound, "/") + } } }