Commit 4f3d81bc by jay

.

1 parent 20dc66c1
...@@ -122,6 +122,22 @@ ...@@ -122,6 +122,22 @@
"type": "relation", "type": "relation",
"relation": "oneToOne", "relation": "oneToOne",
"target": "api::township.township" "target": "api::township.township"
},
"termsAndConditions": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "boolean"
},
"existingOwner": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "boolean"
} }
} }
} }
...@@ -45,12 +45,10 @@ const userPermissionExtension = (plugin) => { ...@@ -45,12 +45,10 @@ const userPermissionExtension = (plugin) => {
where: { where: {
$and: [ $and: [
{ publishedAt: { $notNull: true } }, { publishedAt: { $notNull: true } },
// { user: { email: { $eq: emailAddress } } },
{ mobileNo: mobileNumber }, { mobileNo: mobileNumber },
], ],
}, },
}); });
if (!endUser) { if (!endUser) {
throw new ValidationError( throw new ValidationError(
"No end user registered with specified email address, mobile number combination." "No end user registered with specified email address, mobile number combination."
...@@ -71,7 +69,7 @@ const userPermissionExtension = (plugin) => { ...@@ -71,7 +69,7 @@ const userPermissionExtension = (plugin) => {
{} {}
); );
const oneTimePassword = Math.floor(100000 + Math.random() * 900000); const oneTimePassword = Math.floor(100000 + Math.random() * 900000);
console.log("oneTimePassword",oneTimePassword);
const emailToSend = { const emailToSend = {
to: user.email, to: user.email,
from: from:
...@@ -83,11 +81,12 @@ const userPermissionExtension = (plugin) => { ...@@ -83,11 +81,12 @@ const userPermissionExtension = (plugin) => {
text: `Hello ${endUser.fullName}, Your one time password to login to your partner portal is ${oneTimePassword}`, text: `Hello ${endUser.fullName}, Your one time password to login to your partner portal is ${oneTimePassword}`,
html: `<p>Hello ${endUser.fullName}, <br></br>Your one time password to login to the hiranandani offers portal is ${oneTimePassword}</p><br /> Best Regards, <br /> Team Hiranandani.`, html: `<p>Hello ${endUser.fullName}, <br></br>Your one time password to login to the hiranandani offers portal is ${oneTimePassword}</p><br /> Best Regards, <br /> Team Hiranandani.`,
}; };
console.log('user',user);
// NOTE: Update the user before sending the email so an Admin can generate the link if the email fails // NOTE: Update the user before sending the email so an Admin can generate the link if the email fails
await getService("user").edit(user.id, { const updateUser=await getService("user").edit(user.id, {
oneTimePassword: `${oneTimePassword}`, oneTimePassword: `${oneTimePassword}`,
}); });
console.log("updateUser",updateUser);
// Send an email to the user. // Send an email to the user.
await strapi.plugin("email").service("email").send(emailToSend); await strapi.plugin("email").service("email").send(emailToSend);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!