2024-04-20 06:05:50 +00:00
|
|
|
package ui
|
|
|
|
|
2024-04-20 17:33:42 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
2024-04-21 09:47:22 +00:00
|
|
|
|
2024-04-20 17:33:42 +00:00
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
)
|
|
|
|
|
2024-06-22 05:04:21 +00:00
|
|
|
func DoAuthRedirect(c *fiber.Ctx) error {
|
|
|
|
uri := c.Request().URI().FullURI()
|
|
|
|
return c.Redirect(fmt.Sprintf("/sign-in?redirect_uri=%s", string(uri)))
|
|
|
|
}
|
2024-04-20 06:05:50 +00:00
|
|
|
|
2024-06-22 05:04:21 +00:00
|
|
|
func MapUserInterface(A *fiber.App) {
|
2024-04-20 06:05:50 +00:00
|
|
|
pages := A.Group("/").Name("Pages")
|
2024-04-20 14:50:09 +00:00
|
|
|
|
2024-04-21 09:47:22 +00:00
|
|
|
pages.Get("/", func(c *fiber.Ctx) error {
|
|
|
|
return c.Redirect("/users/me")
|
|
|
|
})
|
|
|
|
|
2024-04-20 14:50:09 +00:00
|
|
|
pages.Get("/sign-up", signupPage)
|
2024-04-20 06:05:50 +00:00
|
|
|
pages.Get("/sign-in", signinPage)
|
2024-04-20 17:33:42 +00:00
|
|
|
pages.Get("/mfa", mfaRequestPage)
|
|
|
|
pages.Get("/mfa/apply", mfaApplyPage)
|
2024-06-22 05:04:21 +00:00
|
|
|
pages.Get("/authorize", authorizePage)
|
2024-04-20 14:50:09 +00:00
|
|
|
|
|
|
|
pages.Post("/sign-up", signupAction)
|
|
|
|
pages.Post("/sign-in", signinAction)
|
2024-04-20 17:33:42 +00:00
|
|
|
pages.Post("/mfa", mfaRequestAction)
|
|
|
|
pages.Post("/mfa/apply", mfaApplyAction)
|
2024-06-22 05:04:21 +00:00
|
|
|
pages.Post("/authorize", authorizeAction)
|
2024-04-20 17:33:42 +00:00
|
|
|
|
2024-06-22 05:04:21 +00:00
|
|
|
pages.Get("/users/me", selfUserinfoPage)
|
2024-04-20 06:05:50 +00:00
|
|
|
}
|