changed the error type from application to forbidden

This commit is contained in:
Kushal Kanungo 2023-09-12 20:24:43 +05:30
parent a8149c55fd
commit ae06d7f100

View File

@ -26,7 +26,7 @@ const {
} = require('./validation/auth'); } = require('./validation/auth');
const { getAbsoluteAdminUrl, getAbsoluteServerUrl, sanitize } = utils; const { getAbsoluteAdminUrl, getAbsoluteServerUrl, sanitize } = utils;
const { ApplicationError, ValidationError } = utils.errors; const { ApplicationError, ValidationError, ForbiddenError } = utils.errors;
const sanitizeUser = (user, ctx) => { const sanitizeUser = (user, ctx) => {
const { auth } = ctx.state; const { auth } = ctx.state;
@ -100,8 +100,8 @@ module.exports = {
try { try {
const user = await getService('providers').connect(provider, ctx.query); const user = await getService('providers').connect(provider, ctx.query);
if (user.blocked === true) { if (user.blocked) {
throw new ApplicationError('Your account is blocked!'); throw new ForbiddenError('Your account has been blocked by an administrator');
} }
return ctx.send({ return ctx.send({