🆕授权登陆接口

This commit is contained in:
coward
2024-03-07 11:03:46 +08:00
parent 2ac91bf012
commit 1c0a128855
16 changed files with 336 additions and 175 deletions

View File

@@ -11,6 +11,6 @@ import (
func Captcha(r *gin.Engine) {
captcha := r.Group("captcha")
{
captcha.GET("captcha", api.Captcha().GenerateCaptcha) // 生成验证码
captcha.GET("", api.Captcha().GenerateCaptcha) // 生成验证码
}
}

View File

@@ -3,11 +3,19 @@ package route
import (
"github.com/gin-gonic/gin"
"wireguard-dashboard/http/api"
"wireguard-dashboard/middleware"
)
func UserApi(r *gin.Engine) {
// 登陆相关API
login := r.Group("/login")
{
login.POST("", api.UserApi().Login)
}
// 用户登陆后相关的API
userApi := r.Group("user")
{
userApi.POST("/login", api.UserApi().Login) // 登陆
userApi.GET("", middleware.Authorization(), api.UserApi().GetUser) // 获取登陆用户信息
}
}