auth.go 701 B

123456789101112131415161718192021
  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. authTokenController := new(controller.AuthController)
  16. authTokenGroup := baseGroup.Group("auth/").Use(middleware.Token())
  17. authTokenGroup.POST("modifyPwd", authTokenController.ModifyPwd).Use(middleware.Token())
  18. }