mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 02:56:22 +00:00
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 13s
- Removed the old reset password form component and replaced it with a new implementation. - Updated routing paths for login, registration, and reset password to be under a common auth path. - Added new login and registration pages with corresponding forms. - Introduced a common auth header component for consistent branding across auth pages. - Implemented a current logged-in user display component. - Enhanced the register form to include email verification and captcha. - Updated translations for new and modified components. - Refactored the navigation bar to include user avatar dropdown and improved menu structure.
32 lines
1.6 KiB
Go
32 lines
1.6 KiB
Go
package apiv1
|
|
|
|
import (
|
|
"github.com/cloudwego/hertz/pkg/route"
|
|
"github.com/snowykami/neo-blog/internal/controller/v1"
|
|
"github.com/snowykami/neo-blog/internal/middleware"
|
|
)
|
|
|
|
func registerUserRoutes(group *route.RouterGroup) {
|
|
const userRoute = "/user"
|
|
userController := v1.NewUserController()
|
|
userGroup := group.Group(userRoute).Use(middleware.UseAuth(true))
|
|
userGroupWithoutAuth := group.Group(userRoute).Use(middleware.UseAuth(false))
|
|
userGroupWithoutAuthNeedsCaptcha := group.Group(userRoute).Use(middleware.UseCaptcha())
|
|
{
|
|
userGroupWithoutAuthNeedsCaptcha.POST("/login", userController.Login)
|
|
userGroupWithoutAuthNeedsCaptcha.POST("/register", userController.Register)
|
|
userGroupWithoutAuth.POST("/email/verify", userController.VerifyEmail) // Send email verification code
|
|
userGroupWithoutAuth.GET("/captcha", userController.GetCaptchaConfig)
|
|
userGroupWithoutAuth.GET("/oidc/list", userController.OidcList)
|
|
userGroupWithoutAuth.GET("/oidc/login/:name", userController.OidcLogin)
|
|
userGroupWithoutAuth.GET("/u/:id", userController.GetUser)
|
|
userGroupWithoutAuth.GET("/username/:username", userController.GetUserByUsername)
|
|
userGroup.POST("/logout", userController.Logout)
|
|
userGroup.GET("/me", userController.GetUser)
|
|
userGroup.PUT("/u/:id", userController.UpdateUser)
|
|
userGroup.PUT("/password/edit", userController.ChangePassword)
|
|
group.Group(userRoute).Use(middleware.UseEmailVerify()).PUT("/password/reset", userController.ResetPassword) // 不需要登录
|
|
group.Group(userRoute).Use(middleware.UseAuth(true), middleware.UseEmailVerify()).PUT("/email/edit", userController.ChangeEmail)
|
|
}
|
|
}
|