chore: update auth and portal

This commit is contained in:
2026-01-14 11:29:17 +08:00
parent fb0a1c2f84
commit 3bcee7efc2
42 changed files with 5969 additions and 3014 deletions

View File

@@ -64,9 +64,6 @@ func (m *Middlewares) authenticate(ctx fiber.Ctx, requireToken bool) error {
if user.Status == consts.UserStatusBanned {
return errorx.ErrAccountDisabled
}
if user.Status == consts.UserStatusBanned {
return errorx.ErrAccountDisabled
}
// Set Context
ctx.Locals(consts.CtxKeyUser, user)
@@ -104,6 +101,9 @@ func (m *Middlewares) SuperAuth(ctx fiber.Ctx) error {
if err != nil {
return errorx.ErrUnauthorized.WithCause(err).WithMsg("UserNotFound")
}
if user.Status == consts.UserStatusBanned {
return errorx.ErrAccountDisabled
}
if !hasRole(user.Roles, consts.RoleSuperAdmin) {
return errorx.ErrForbidden.WithMsg("无权限访问")