settings

This commit is contained in:
微凉
2021-10-30 00:35:29 +08:00
parent 57ad66b43a
commit 0324ea1fcb
13 changed files with 97 additions and 52 deletions

View File

@ -9,7 +9,7 @@ import (
)
func Auth(ctx *fiber.Ctx) error {
token := ctx.Get("token")
token := ctx.Get("Authorization")
password, err := model.GetSettingByKey("password")
if err != nil {
if err == gorm.ErrRecordNotFound {
@ -23,6 +23,15 @@ func Auth(ctx *fiber.Ctx) error {
return ctx.Next()
}
func Login(ctx *fiber.Ctx) error {
return SuccessResp(ctx)
}
func SetSuccess(ctx *fiber.Ctx) error {
ctx.Status(200)
return ctx.Next()
}
func CheckAccount(ctx *fiber.Ctx) error {
if model.AccountsCount() == 0 {
return ErrorResp(ctx,fmt.Errorf("no accounts,please add one first"),1001)