Update User.js

This commit is contained in:
Aurélien GEORGET 2018-03-19 17:31:04 +01:00 committed by GitHub
parent 5d82812355
commit 11c68bebf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,7 +130,7 @@ module.exports = {
email: ctx.request.body.email
});
if ((user.id || user._id).toString() !== ctx.params.id) {
if (user !== null && (user.id || user._id).toString() !== ctx.params.id) {
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.email.taken' }] }] : 'Email is already taken.');
}
}