mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 02:56:22 +00:00
- Refactored userLogin function to include captcha handling. - Introduced getCaptchaConfig API to fetch captcha configuration. - Added Captcha component to handle different captcha providers (hCaptcha, reCaptcha, Turnstile). - Updated LoginForm component to integrate captcha verification. - Created UserProfile component to display user information with avatar. - Implemented getUserByUsername API to fetch user details by username. - Removed deprecated LoginRequest interface from user model. - Enhanced navbar and layout with animation effects. - Removed unused user page component and added dynamic user profile routing. - Updated localization files to include captcha-related messages. - Improved Gravatar component for better avatar handling.
30 lines
1.4 KiB
Go
30 lines
1.4 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) {
|
|
userController := v1.NewUserController()
|
|
userGroup := group.Group("/user").Use(middleware.UseAuth(true))
|
|
userGroupWithoutAuth := group.Group("/user").Use(middleware.UseAuth(false))
|
|
userGroupWithoutAuthNeedsCaptcha := group.Group("/user").Use(middleware.UseCaptcha())
|
|
{
|
|
userGroupWithoutAuthNeedsCaptcha.POST("/login", userController.Login)
|
|
userGroupWithoutAuthNeedsCaptcha.POST("/register", userController.Register)
|
|
userGroupWithoutAuthNeedsCaptcha.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.GET("/me", userController.GetUser)
|
|
userGroupWithoutAuth.POST("/logout", userController.Logout)
|
|
userGroup.PUT("/u/:id", userController.UpdateUser)
|
|
userGroup.PUT("/password/edit", userController.ChangePassword)
|
|
userGroup.PUT("/email/edit", userController.ChangeEmail)
|
|
}
|
|
}
|