chore: update auth and portal
This commit is contained in:
@@ -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("无权限访问")
|
||||
|
||||
Reference in New Issue
Block a user