mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
commit
b0c12a3912
@ -32,11 +32,11 @@ module.exports = async (ctx, next) => {
|
||||
name: 'users-permissions'
|
||||
});
|
||||
|
||||
if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && ctx.state.user.confirmed !== true) {
|
||||
if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && !ctx.state.user.confirmed) {
|
||||
return handleErrors(ctx, 'Your account email is not confirmed.', 'unauthorized');
|
||||
}
|
||||
|
||||
if (ctx.state.user.blocked === true) {
|
||||
if (ctx.state.user.blocked) {
|
||||
return handleErrors(ctx, 'Your account has been blocked by the administrator.', 'unauthorized');
|
||||
}
|
||||
}
|
||||
@ -74,4 +74,4 @@ const handleErrors = (ctx, err = undefined, type) => {
|
||||
}
|
||||
|
||||
return ctx[type](err);
|
||||
};
|
||||
};
|
||||
|
||||
@ -57,11 +57,11 @@ module.exports = {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.');
|
||||
}
|
||||
|
||||
if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && user.confirmed !== true) {
|
||||
if (_.get(await store.get({key: 'advanced'}), 'email_confirmation') && !user.confirmed) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.confirmed' }] }] : 'Your account email is not confirmed.');
|
||||
}
|
||||
|
||||
if (user.blocked === true) {
|
||||
if (user.blocked) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.');
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user