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