formated email template username
This commit is contained in:
parent
c543af3b96
commit
d3389a5529
@ -28,6 +28,13 @@ const sanitizeStringValue = (value) =>
|
|||||||
? sanitize(value, { allowedTags: [], allowedAttributes: {} })
|
? sanitize(value, { allowedTags: [], allowedAttributes: {} })
|
||||||
: value;
|
: value;
|
||||||
|
|
||||||
|
function formatName(name) {
|
||||||
|
return name
|
||||||
|
.replace(/([A-Z])/g, ' $1')
|
||||||
|
.replace(/\b\w/g, char => char.toUpperCase())
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
exports.testEmail = async (req, res) => {
|
exports.testEmail = async (req, res) => {
|
||||||
placeHolderData = {
|
placeHolderData = {
|
||||||
contact_name : '<contactName>',
|
contact_name : '<contactName>',
|
||||||
@ -263,7 +270,7 @@ exports.createEstablishment = async (req, res) => {
|
|||||||
const emailSupportPhone = process.env.SUPPORT_PHONE;
|
const emailSupportPhone = process.env.SUPPORT_PHONE;
|
||||||
|
|
||||||
const placeHolderData = {
|
const placeHolderData = {
|
||||||
contact_name: emailContactName,
|
contact_name: formatName(emailContactName),
|
||||||
portal_url: emailPortalUrl,
|
portal_url: emailPortalUrl,
|
||||||
username: emailUsername,
|
username: emailUsername,
|
||||||
password: plainPasswordForEmail,
|
password: plainPasswordForEmail,
|
||||||
@ -1067,7 +1074,7 @@ exports.forgotPasswordRequestOTP = async (req, res) => {
|
|||||||
|
|
||||||
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
||||||
const placeHolderData = {
|
const placeHolderData = {
|
||||||
username: user.name,
|
username: formatName(user.name),
|
||||||
verfication_code: otp,
|
verfication_code: otp,
|
||||||
otp_expiry: 10,
|
otp_expiry: 10,
|
||||||
support_email: process.env.SUPPORT_EMAIL,
|
support_email: process.env.SUPPORT_EMAIL,
|
||||||
@ -1097,7 +1104,7 @@ exports.forgotPasswordRequestOTP = async (req, res) => {
|
|||||||
|
|
||||||
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
||||||
const placeHolderData = {
|
const placeHolderData = {
|
||||||
username: user.name,
|
username: formatName(user.name),
|
||||||
verfication_code: otp,
|
verfication_code: otp,
|
||||||
otp_expiry: 10,
|
otp_expiry: 10,
|
||||||
support_email: process.env.SUPPORT_EMAIL,
|
support_email: process.env.SUPPORT_EMAIL,
|
||||||
@ -1275,9 +1282,8 @@ exports.requestOTPForLogin = async (req, res) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
const formattedSupportPhone = formatUAEPhoneNumber(process.env.SUPPORT_PHONE);
|
||||||
// const formattedOtp = otp.split("").join(" ");
|
|
||||||
const placeHolderData = {
|
const placeHolderData = {
|
||||||
username: loggingUser.name,
|
username: formatName(loggingUser.name),
|
||||||
verfication_code: otp,
|
verfication_code: otp,
|
||||||
otp_expiry: 10,
|
otp_expiry: 10,
|
||||||
support_email: process.env.SUPPORT_EMAIL,
|
support_email: process.env.SUPPORT_EMAIL,
|
||||||
@ -1932,7 +1938,7 @@ exports.establishmentBulkUpload = async (req, res) => {
|
|||||||
}, { transaction: transaction });
|
}, { transaction: transaction });
|
||||||
|
|
||||||
const placeHolderData = {
|
const placeHolderData = {
|
||||||
contact_name: r.user_name,
|
contact_name:formatName(r.user_name),
|
||||||
portal_url: process.env.FE_BASE_URL,
|
portal_url: process.env.FE_BASE_URL,
|
||||||
username: p.email,
|
username: p.email,
|
||||||
password: autoPassword,
|
password: autoPassword,
|
||||||
|
|||||||
@ -8,6 +8,13 @@ const { sanitizeForLog } = require("../utils/sanitize");
|
|||||||
const logger = require("../services/logger");
|
const logger = require("../services/logger");
|
||||||
const User = db.user;
|
const User = db.user;
|
||||||
|
|
||||||
|
function formatName(name) {
|
||||||
|
return name
|
||||||
|
.replace(/([A-Z])/g, ' $1')
|
||||||
|
.replace(/\b\w/g, char => char.toUpperCase())
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
// Create User
|
// Create User
|
||||||
exports.createUser = async (req, res) => {
|
exports.createUser = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
@ -98,7 +105,7 @@ exports.createUser = async (req, res) => {
|
|||||||
const emailSupportPhone = process.env.SUPPORT_PHONE;
|
const emailSupportPhone = process.env.SUPPORT_PHONE;
|
||||||
|
|
||||||
const emailData = {
|
const emailData = {
|
||||||
contact_name: emailContactName,
|
contact_name: formatName(emailContactName),
|
||||||
portal_url: emailPortalUrl,
|
portal_url: emailPortalUrl,
|
||||||
username: emailUsername,
|
username: emailUsername,
|
||||||
password: plainPasswordForEmail,
|
password: plainPasswordForEmail,
|
||||||
@ -331,7 +338,7 @@ exports.triggerEstablishmentUsersWelcomeEmail = async (req, res) => {
|
|||||||
user.email,
|
user.email,
|
||||||
"establishment_user_creation_to_user",
|
"establishment_user_creation_to_user",
|
||||||
{
|
{
|
||||||
contact_name: user.name,
|
contact_name: formatName(user.name),
|
||||||
portal_url: process.env.FE_BASE_URL,
|
portal_url: process.env.FE_BASE_URL,
|
||||||
username: user.email,
|
username: user.email,
|
||||||
password: password,
|
password: password,
|
||||||
|
|||||||
@ -839,9 +839,15 @@ const QuarterlyWindowsConfiguration = db.QuarterlyWindowsConfiguration;
|
|||||||
};
|
};
|
||||||
|
|
||||||
const surveyData = await QuarterlyWindowsConfiguration.findOne({ where: { year :result['year'] , quarter : result['quarter'] } });
|
const surveyData = await QuarterlyWindowsConfiguration.findOne({ where: { year :result['year'] , quarter : result['quarter'] } });
|
||||||
|
function formatName(name) {
|
||||||
|
return name
|
||||||
|
.replace(/([A-Z])/g, ' $1')
|
||||||
|
.replace(/\b\w/g, char => char.toUpperCase())
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
const userName = sanitizeForLog(userObj.name),
|
||||||
placeHolderData = {
|
placeHolderData = {
|
||||||
user_name: sanitizeForLog(userObj.name),
|
user_name: userName,
|
||||||
portal_url : process.env.FE_BASE_URL,
|
portal_url : process.env.FE_BASE_URL,
|
||||||
quarter : result['quarter'],
|
quarter : result['quarter'],
|
||||||
year : result['year'],
|
year : result['year'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user