🎨配置文件的初始化
This commit is contained in:
@@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mojocn/base64Captcha"
|
||||
"wireguard-dashboard/compoment"
|
||||
"wireguard-dashboard/component"
|
||||
"wireguard-dashboard/utils"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func (captcha) GenerateCaptcha(c *gin.Context) {
|
||||
math := base64Captcha.DriverMath{Height: 60, Width: 240, Fonts: []string{"ApothecaryFont.ttf", "3Dumb.ttf"}}
|
||||
mathDriver := math.ConvertFonts()
|
||||
|
||||
capt := base64Captcha.NewCaptcha(mathDriver, compoment.CaptchaStore{})
|
||||
capt := base64Captcha.NewCaptcha(mathDriver, component.CaptchaStore{})
|
||||
|
||||
id, base64Str, _, err := capt.Generate()
|
||||
if err != nil {
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"wireguard-dashboard/client"
|
||||
"wireguard-dashboard/compoment"
|
||||
"wireguard-dashboard/component"
|
||||
"wireguard-dashboard/constant"
|
||||
"wireguard-dashboard/http/param"
|
||||
"wireguard-dashboard/model/entity"
|
||||
@@ -31,7 +31,7 @@ func (user) Login(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 校验验证码
|
||||
pass := compoment.CaptchaStore{}.Verify(p.CaptchaId, p.CaptchaAnswer, true)
|
||||
pass := component.CaptchaStore{}.Verify(p.CaptchaId, p.CaptchaAnswer, true)
|
||||
if !pass {
|
||||
utils.GinResponse(c).FailedWithMsg("验证码错误")
|
||||
return
|
||||
@@ -56,7 +56,7 @@ func (user) Login(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 生成token
|
||||
token, err := compoment.JWT().GenerateToken(user.Id)
|
||||
token, err := component.JWT().GenerateToken(user.Id)
|
||||
if err != nil {
|
||||
utils.GinResponse(c).FailedWithMsg("登陆失败")
|
||||
return
|
||||
@@ -78,7 +78,7 @@ func (user) Logout(c *gin.Context) {
|
||||
utils.GinResponse(c).FailedWithMsg("你还没有登陆")
|
||||
return
|
||||
}
|
||||
if err := compoment.JWT().Logout(data.(*entity.User).Id); err != nil {
|
||||
if err := component.JWT().Logout(data.(*entity.User).Id); err != nil {
|
||||
log.Errorf("退出登陆失败: %v", err.Error())
|
||||
utils.GinResponse(c).FailedWithMsg("退出登陆失败")
|
||||
return
|
||||
|
Reference in New Issue
Block a user