Commit 44bd4eea by jaymehta

.

1 parent 032b169b
...@@ -65,7 +65,7 @@ const userPermissionExtension = (plugin) => { ...@@ -65,7 +65,7 @@ const userPermissionExtension = (plugin) => {
{ username: email }, { username: email },
{ username }, { username },
{ email: username }, { email: username },
{phone: phone} { phone: phone },
], ],
}; };
const conflictingUserCount = await strapi const conflictingUserCount = await strapi
...@@ -73,12 +73,16 @@ const userPermissionExtension = (plugin) => { ...@@ -73,12 +73,16 @@ const userPermissionExtension = (plugin) => {
.count({ .count({
where: { ...identifierFilter, provider }, where: { ...identifierFilter, provider },
}); });
const conflictingUser = await strapi
.query("plugin::users-permissions.user")
.findOne({ where: { ...identifierFilter } });
if (conflictingUserCount > 0) { if (conflictingUserCount > 0) {
return ctx.send({ return ctx.send({
status: "fail", status: "fail",
message: "Email or phone number already taken.", message: "Email or phone number already taken.",
conflictingUserCount identifierFilter,
conflictingUserCount,
conflictingUser,
}); });
} }
...@@ -93,7 +97,9 @@ const userPermissionExtension = (plugin) => { ...@@ -93,7 +97,9 @@ const userPermissionExtension = (plugin) => {
return ctx.send({ return ctx.send({
status: "fail", status: "fail",
message: "Email or phone number already taken.", message: "Email or phone number already taken.",
conflictingUserCount identifierFilter,
conflictingUserCount,
conflictingUser,
}); });
} }
} }
...@@ -104,7 +110,7 @@ const userPermissionExtension = (plugin) => { ...@@ -104,7 +110,7 @@ const userPermissionExtension = (plugin) => {
email: email, email: email,
username, username,
confirmed: false, confirmed: false,
phone: phone phone: phone,
}; };
const user = await strapi const user = await strapi
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!