Merge branch 'hot-fix/1.1.1/login' into test

This commit is contained in:
LinkinStars 2023-08-18 10:59:53 +08:00
commit 0f26ab5aa7
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
env:
- GO11MODULE=on
- GO111MODULE=on
- GOPROXY=https://goproxy.io
- GOPROXY=https://goproxy.io,direct
- CGO_ENABLED=0
before:
@ -15,7 +15,7 @@ builds:
- id: build
main: ./cmd/answer/.
binary: answer
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
ldflags: -s -w -X github.com/answerdev/answer/cmd.Version={{.Version}} -X github.com/answerdev/answer/cmd.Revision={{.ShortCommit}} -X github.com/answerdev/answer/cmd.Time={{.Date}} -X github.com/answerdev/answer/cmd.BuildUser=goreleaser
flags: -v
goos:
- linux
@ -26,7 +26,7 @@ builds:
- id: build-windows
main: ./cmd/answer/.
binary: answer
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
ldflags: -s -w -X github.com/answerdev/answer/cmd.Version={{.Version}} -X github.com/answerdev/answer/cmd.Revision={{.ShortCommit}} -X github.com/answerdev/answer/cmd.Time={{.Date}} -X github.com/answerdev/answer/cmd.BuildUser=goreleaser
flags: -v
goos:
- windows

View File

@ -48,7 +48,7 @@ func NewHTTPServer(debug bool,
// The route must be available without logging in
mustUnAuthV1 := r.Group("/answer/api/v1")
answerRouter.RegisterMustUnAuthAnswerAPIRouter(mustUnAuthV1)
answerRouter.RegisterMustUnAuthAnswerAPIRouter(authUserMiddleware, mustUnAuthV1)
// register api that no need to login
unAuthV1 := r.Group("/answer/api/v1")

View File

@ -94,7 +94,7 @@ func NewAnswerAPIRouter(
}
}
func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(r *gin.RouterGroup) {
func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(authUserMiddleware *middleware.AuthUserMiddleware, r *gin.RouterGroup) {
// i18n
r.GET("/language/config", a.langController.GetLangMapping)
r.GET("/language/options", a.langController.GetUserLangOptions)
@ -105,6 +105,7 @@ func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(r *gin.RouterGroup)
// user
r.GET("/user/info", a.userController.GetUserInfoByUserID)
r.GET("/user/action/record", authUserMiddleware.Auth(), a.userController.ActionRecord)
routerGroup := r.Group("", middleware.BanAPIForUserCenter)
routerGroup.POST("/user/login/email", a.userController.UserEmailLogin)
routerGroup.POST("/user/register/email", a.userController.UserRegisterByEmail)
@ -123,7 +124,6 @@ func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) {
r.POST("/user/email/verification/send", middleware.BanAPIForUserCenter, a.userController.UserVerifyEmailSend)
r.GET("/personal/user/info", a.userController.GetOtherUserInfoByUsername)
r.GET("/user/ranking", a.userController.UserRanking)
r.GET("/user/action/record", a.userController.ActionRecord)
//answer
r.GET("/answer/info", a.answerController.Get)