Add setup-flow

This commit is contained in:
2026-03-21 03:12:13 +01:00
parent 80a2f662dc
commit dd044cf5d0
17 changed files with 519 additions and 37 deletions

View File

@@ -64,3 +64,7 @@ func (h *Handler) Logout(c *gin.Context) {
c.SetCookie("auth_token", "", -1, "/", "", false, true)
c.Redirect(302, "/")
}
func (h *Handler) ChangePasswordPage(c *gin.Context) {
c.HTML(200, "changePassword.html", nil)
}

View File

@@ -2,19 +2,22 @@ package web
import (
"ResendIt/internal/api/middleware"
"ResendIt/internal/user"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(r *gin.Engine, h *Handler) {
func RegisterRoutes(r *gin.Engine, h *Handler, userService *user.Service) {
r.GET("/", h.Index)
r.GET("/upload", h.UploadPage)
//r.GET("/upload", h.UploadPage)
r.GET("/login", h.LoginPage)
adminRoutes := r.Group("/")
adminRoutes.Use(middleware.AuthMiddleware())
adminRoutes.Use(middleware.RequireRole("admin"))
adminRoutes.Use(user.ForcePasswordChangeMiddleware(userService))
adminRoutes.GET("/admin", h.AdminPage)
adminRoutes.GET("/logout", h.Logout)
adminRoutes.GET("/change-password", h.ChangePasswordPage)
}