Merge pull request #2907 from EpicUsaMan/patch-4

Fix for SQLite #2879
This commit is contained in:
Jim LAURIE 2019-03-01 10:29:59 +01:00 committed by GitHub
commit b0c12a3912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -32,11 +32,11 @@ module.exports = async (ctx, next) => {
name: 'users-permissions' 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'); 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'); 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); return ctx[type](err);
}; };

View File

@ -57,11 +57,11 @@ module.exports = {
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.'); 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.'); 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.'); return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.');
} }