mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Fix update user email
This commit is contained in:
parent
6478e1f2b3
commit
b4968697a0
@ -120,7 +120,7 @@ module.exports = {
|
||||
if (advancedConfigs.unique_email && ctx.request.body.email) {
|
||||
const users = await strapi.plugins['users-permissions'].services.user.fetchAll({ email: ctx.request.body.email });
|
||||
|
||||
if (users && _.find(users, user => (user.id || user._id).toString() !== ctx.params._id)) {
|
||||
if (users && _.find(users, user => (user.id || user._id).toString() !== (ctx.params.id || ctx.params._id))) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.email.taken', field: ['email'] }] }] : 'Email is already taken.');
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ module.exports = {
|
||||
email: ctx.request.body.email
|
||||
});
|
||||
|
||||
if (user !== null && (user.id || user._id).toString() !== ctx.params._id) {
|
||||
if (user !== null && (user.id || user._id).toString() !== (ctx.params.id || ctx.params._id)) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.email.taken', field: ['email'] }] }] : 'Email is already taken.');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user