auth.go 870 B

123456789101112131415161718192021222324
  1. package routers
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "hongze/hongze_yb_en_api/controller"
  5. "hongze/hongze_yb_en_api/middleware"
  6. )
  7. func InitAuth(baseGroup *gin.RouterGroup) {
  8. //登录
  9. authController := new(controller.AuthController)
  10. authGroup := baseGroup.Group("auth/")
  11. authGroup.POST("login", authController.Login)
  12. authGroup.POST("register", authController.Register)
  13. authGroup.GET("smsCode", authController.GetSmsCode)
  14. authGroup.GET("emailCode", authController.GetEmailCode)
  15. authGroup.POST("forgetPwd", authController.ForgetPwd)
  16. authTokenController := new(controller.AuthController)
  17. authTokenGroup := baseGroup.Group("auth/").Use(middleware.Token())
  18. authTokenGroup.POST("modifyPwd", authTokenController.ModifyPwd)
  19. authTokenGroup.POST("bindMobile", authTokenController.BindMobile)
  20. authTokenGroup.POST("modifyMobile", authTokenController.ModifyMobile)
  21. }