mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
feat: add emailcount of user
This commit is contained in:
@@ -15,7 +15,8 @@ function EmailComponent({
|
||||
setSuccessEmail,
|
||||
pdfName,
|
||||
sender,
|
||||
setIsAlert
|
||||
setIsAlert,
|
||||
extUserId
|
||||
}) {
|
||||
const [emailList, setEmailList] = useState([]);
|
||||
const [emailValue, setEmailValue] = useState();
|
||||
@@ -38,6 +39,7 @@ function EmailComponent({
|
||||
const openSignUrl = "https://www.opensignlabs.com/contact-us";
|
||||
const themeBGcolor = themeColor;
|
||||
let params = {
|
||||
extUserId: extUserId,
|
||||
pdfName: pdfName,
|
||||
url: pdfUrl,
|
||||
recipient: emailList[i],
|
||||
|
||||
@@ -94,6 +94,7 @@ function PdfRequestFiles() {
|
||||
const [sendInOrder, setSendInOrder] = useState(false);
|
||||
const [currWidgetsDetails, setCurrWidgetsDetails] = useState({});
|
||||
const [isSubscribed, setIsSubscribed] = useState(false);
|
||||
const [extUserId, setExtUserId] = useState("");
|
||||
const divRef = useRef(null);
|
||||
const isMobile = window.innerWidth < 767;
|
||||
const rowLevel =
|
||||
@@ -169,6 +170,7 @@ function PdfRequestFiles() {
|
||||
if (isEnableSubscription) {
|
||||
await checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||
}
|
||||
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
||||
const isCompleted =
|
||||
documentData[0].IsCompleted && documentData[0].IsCompleted;
|
||||
const expireDate = documentData[0].ExpiryDate.iso;
|
||||
@@ -624,10 +626,10 @@ function PdfRequestFiles() {
|
||||
: "";
|
||||
const themeBGcolor = themeColor;
|
||||
let params = {
|
||||
extUserId: extUserId,
|
||||
recipient: user.Email,
|
||||
subject: `${pdfDetails?.[0].ExtUserPtr.Name} has requested you to sign ${pdfDetails?.[0].Name}`,
|
||||
from: sender,
|
||||
|
||||
html:
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </head> <body> <div style='background-color: #f5f5f5; padding: 20px'=> <div style=' box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background: white;padding-bottom: 20px;'> <div style='padding:10px 10px 0 10px'><img src=" +
|
||||
imgPng +
|
||||
|
||||
@@ -110,6 +110,7 @@ function PlaceHolderSign() {
|
||||
status: false,
|
||||
message: ""
|
||||
});
|
||||
const [extUserId, setExtUserId] = useState("");
|
||||
const isMobile = window.innerWidth < 767;
|
||||
const [, drop] = useDrop({
|
||||
accept: "BOX",
|
||||
@@ -206,6 +207,7 @@ function PlaceHolderSign() {
|
||||
//getting document details
|
||||
const documentData = await contractDocument(documentId);
|
||||
if (documentData && documentData.length > 0) {
|
||||
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
||||
if (isEnableSubscription) {
|
||||
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||
}
|
||||
@@ -761,7 +763,7 @@ function PlaceHolderSign() {
|
||||
const pdfData = await pdfFile.save();
|
||||
const pdfUrl = pdfData.url();
|
||||
const tenantId = localStorage.getItem("TenantId");
|
||||
const buffer = atob(pdfBytes)
|
||||
const buffer = atob(pdfBytes);
|
||||
SaveFileSize(buffer.length, pdfUrl, tenantId);
|
||||
return pdfUrl;
|
||||
} catch (e) {
|
||||
@@ -856,6 +858,7 @@ function PlaceHolderSign() {
|
||||
: "";
|
||||
const themeBGcolor = themeColor;
|
||||
let params = {
|
||||
extUserId: extUserId,
|
||||
recipient: signerMail[i].Email,
|
||||
subject: `${pdfDetails?.[0].ExtUserPtr.Name} has requested you to sign ${pdfDetails?.[0].Name}`,
|
||||
from: sender,
|
||||
|
||||
@@ -49,7 +49,6 @@ const PlanSubscriptions = () => {
|
||||
try {
|
||||
const params = { userId: Parse.User.current().id };
|
||||
const res = await Parse.Cloud.run("freesubscription", params);
|
||||
console.log("res.result ", res.result);
|
||||
if (res.status === "success" && res.result === "already subscribed!") {
|
||||
setIsLoader(false);
|
||||
alert("You have already subscription of free plan");
|
||||
|
||||
@@ -99,6 +99,7 @@ function SignYourSelf() {
|
||||
});
|
||||
const [isAlert, setIsAlert] = useState({ isShow: false, alertMessage: "" });
|
||||
const [isDontShow, setIsDontShow] = useState(false);
|
||||
const [extUserId, setExtUserId] = useState("");
|
||||
const divRef = useRef(null);
|
||||
const nodeRef = useRef(null);
|
||||
const [, drop] = useDrop({
|
||||
@@ -186,7 +187,7 @@ function SignYourSelf() {
|
||||
|
||||
if (documentData && documentData.length > 0) {
|
||||
setPdfDetails(documentData);
|
||||
|
||||
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
||||
isCompleted = documentData[0].IsCompleted && documentData[0].IsCompleted;
|
||||
if (isCompleted) {
|
||||
const docStatus = {
|
||||
@@ -433,13 +434,13 @@ function SignYourSelf() {
|
||||
Width: widgetTypeExist
|
||||
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth
|
||||
: dragTypeValue === "initials"
|
||||
? defaultWidthHeight(dragTypeValue).width
|
||||
: "",
|
||||
? defaultWidthHeight(dragTypeValue).width
|
||||
: "",
|
||||
Height: widgetTypeExist
|
||||
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight
|
||||
: dragTypeValue === "initials"
|
||||
? defaultWidthHeight(dragTypeValue).height
|
||||
: "",
|
||||
? defaultWidthHeight(dragTypeValue).height
|
||||
: "",
|
||||
options: addWidgetOptions(dragTypeValue)
|
||||
};
|
||||
|
||||
@@ -1120,6 +1121,7 @@ function SignYourSelf() {
|
||||
setSuccessEmail={setSuccessEmail}
|
||||
sender={jsonSender}
|
||||
setIsAlert={setIsAlert}
|
||||
extUserId={extUserId}
|
||||
/>
|
||||
{/* pdf header which contain funish back button */}
|
||||
<Header
|
||||
|
||||
@@ -128,3 +128,27 @@ const saveDataFile = async (size, imageUrl, tenantPtr) => {
|
||||
console.log('error in save usage ', err);
|
||||
}
|
||||
};
|
||||
|
||||
export const updateMailCount = async extUserId => {
|
||||
// Update count in contracts_Users class
|
||||
const query = new Parse.Query('contracts_Users');
|
||||
query.equalTo('objectId', extUserId);
|
||||
|
||||
try {
|
||||
const contractUser = await query.first({ useMasterKey: true });
|
||||
console.log("contractUser", contractUser)
|
||||
|
||||
if (contractUser) {
|
||||
contractUser.increment('EmailCount', 1);
|
||||
await contractUser.save(null, { useMasterKey: true });
|
||||
} else {
|
||||
// Create new entry if not found
|
||||
const ContractsUsers = Parse.Object.extend('contracts_users');
|
||||
const newContractUser = new ContractsUsers();
|
||||
newContractUser.set('EmailCount', 1);
|
||||
await newContractUser.save(null, { useMasterKey: true });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error updating EmailCount in contracts_users: ' + error.message);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -284,6 +284,7 @@ export default async function createDocumentWithTemplate(request, response) {
|
||||
subject: subject,
|
||||
from: sender,
|
||||
html: html,
|
||||
extUserId: template.ExtUserPtr.objectId,
|
||||
};
|
||||
sendMail = await axios.post(url, params, { headers: headers });
|
||||
} catch (error) {
|
||||
|
||||
@@ -336,6 +336,7 @@ export default async function createDocumentwithCoordinate(request, response) {
|
||||
subject: subject,
|
||||
from: sender,
|
||||
html: html,
|
||||
extUserId: extUser.id,
|
||||
};
|
||||
|
||||
await axios.post(url, params, { headers: headers });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import PDF from './parsefunction/pdf/PDF.min.js';
|
||||
import sendmail from './parsefunction/sendMail.js';
|
||||
import sendmailv3 from './parsefunction/sendMailv3.js';
|
||||
import GoogleSign from './parsefunction/GoogleSign.js';
|
||||
import ZohoDetails from './parsefunction/ZohoDetails.js';
|
||||
import usersignup from './parsefunction/usersignup.js';
|
||||
@@ -10,7 +10,6 @@ import DocumentAftersave from './parsefunction/DocumentAftersave.js';
|
||||
import ContactbookAftersave from './parsefunction/ContactBookAftersave.js';
|
||||
import ContractUsersAftersave from './parsefunction/ContractUsersAftersave.js';
|
||||
import sendMailOTPv1 from './parsefunction/SendMailOTPv1.js';
|
||||
import SendMailv1 from './parsefunction/SendMailv1.js';
|
||||
import AuthLoginAsMail from './parsefunction/AuthLoginAsMail.js';
|
||||
import getUserId from './parsefunction/getUserId.js';
|
||||
import getUserDetails from './parsefunction/getUserDetails.js';
|
||||
@@ -30,13 +29,12 @@ import TemplateBeforeSave from './parsefunction/TemplateBeforesave.js';
|
||||
Parse.Cloud.define('AddUserToRole', addUserToGroups);
|
||||
Parse.Cloud.define('UserGroups', getUserGroups);
|
||||
Parse.Cloud.define('signPdf', PDF);
|
||||
Parse.Cloud.define('sendmailv3', sendmail);
|
||||
Parse.Cloud.define('sendmailv3', sendmailv3);
|
||||
Parse.Cloud.define('googlesign', GoogleSign);
|
||||
Parse.Cloud.define('zohodetails', ZohoDetails);
|
||||
Parse.Cloud.define('usersignup', usersignup);
|
||||
Parse.Cloud.define('facebooksign', FacebookSign);
|
||||
Parse.Cloud.define('SendOTPMailV1', sendMailOTPv1);
|
||||
Parse.Cloud.define('sendmail', SendMailv1);
|
||||
Parse.Cloud.define('AuthLoginAsMail', AuthLoginAsMail);
|
||||
Parse.Cloud.define('getUserId', getUserId);
|
||||
Parse.Cloud.define('getUserDetails', getUserDetails);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import { updateMailCount } from '../../Utils.js';
|
||||
|
||||
async function sendMailOTPv1(request) {
|
||||
try {
|
||||
@@ -11,37 +11,40 @@ async function sendMailOTPv1(request) {
|
||||
// console.log(JSON.stringify(request));
|
||||
|
||||
if (email) {
|
||||
axios({
|
||||
method: 'POST',
|
||||
url: process.env.SERVER_URL + '/functions/sendmail',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': process.env.APP_ID,
|
||||
},
|
||||
params: {
|
||||
otp: code,
|
||||
email: email,
|
||||
TenantId: TenantId,
|
||||
},
|
||||
}).then(
|
||||
function (httpResponse) {},
|
||||
function (httpResponse) {
|
||||
console.error('sms Request failed with response code ' + httpResponse.status);
|
||||
return Promise.reject('sms Request failed with response code ' + httpResponse.status);
|
||||
const recipient = request.params.email;
|
||||
const otp = request.params.otp;
|
||||
const mailsender = process.env.SMTP_ENABLE
|
||||
? process.env.SMTP_USER_EMAIL
|
||||
: process.env.MAILGUN_SENDER;
|
||||
try {
|
||||
await Parse.Cloud.sendEmail({
|
||||
from: 'Opensign™' + ' <' + mailsender + '>',
|
||||
recipient: recipient,
|
||||
subject: 'Your OpenSign™ OTP',
|
||||
text: 'This email is a test.',
|
||||
html:
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for OpenSign™ verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>" +
|
||||
otp +
|
||||
'</p></div> </div> </div></body></html>',
|
||||
});
|
||||
console.log('OTP sent');
|
||||
if (request.params?.extUserId) {
|
||||
await updateMailCount(request.params.extUserId);
|
||||
}
|
||||
);
|
||||
|
||||
} catch (err) {
|
||||
console.log('error in send OTP mail', err);
|
||||
}
|
||||
const tempOtp = new Parse.Query('defaultdata_Otp');
|
||||
tempOtp.equalTo('Email', email);
|
||||
const resultOTP = await tempOtp.first({ useMasterKey: true });
|
||||
console.log('resultOTP', resultOTP);
|
||||
// console.log('resultOTP', resultOTP);
|
||||
if (resultOTP !== undefined) {
|
||||
const updateOtpQuery = new Parse.Query('defaultdata_Otp');
|
||||
const updateOtp = await updateOtpQuery.get(resultOTP.id, {
|
||||
useMasterKey: true,
|
||||
});
|
||||
updateOtp.set('OTP', code);
|
||||
const updateRes = updateOtp.save(null, { useMasterKey: true });
|
||||
updateOtp.save(null, { useMasterKey: true });
|
||||
// console.log("update otp Res in tempSendOtp ", updateRes);
|
||||
} else {
|
||||
const otpClass = Parse.Object.extend('defaultdata_Otp');
|
||||
@@ -49,17 +52,17 @@ async function sendMailOTPv1(request) {
|
||||
newOtpQuery.set('OTP', code);
|
||||
newOtpQuery.set('Email', email);
|
||||
newOtpQuery.set('TenantId', TenantId);
|
||||
const newRes = await newOtpQuery.save(null, { useMasterKey: true });
|
||||
await newOtpQuery.save(null, { useMasterKey: true });
|
||||
// console.log("new otp Res in tempSendOtp ", newRes);
|
||||
}
|
||||
return 'Otp send';
|
||||
} else {
|
||||
return Promise.reject('Please Enter valid email');
|
||||
return 'Please Enter valid email';
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('err in sendMailOTPv1');
|
||||
console.log(err);
|
||||
return Promise.reject(err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
export default sendMailOTPv1;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
async function SendMailv1(request) {
|
||||
console.log('in SendMailv1');
|
||||
|
||||
try {
|
||||
const recipient = request.params.email;
|
||||
const otp = request.params.otp;
|
||||
const res = await Parse.Cloud.sendEmail({
|
||||
from: 'Test user' + ' <' + process.env.SMTP_ENABLE ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER + '>',
|
||||
recipient: recipient,
|
||||
subject: 'Your OpenSign™ OTP',
|
||||
text: 'This email is a test.',
|
||||
html:
|
||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for OpenSign™ verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>" +
|
||||
otp +
|
||||
'</p></div> </div> </div></body></html>',
|
||||
// "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body style='text-align: center;'><div style='display:flex;flex-direction:column;justify-content:center;align-item:center;margin:40px'> <p style='font-weight: bolder; font-size: large;'>Hello,</p> <span>Your OTP for LegaDaft verification . </span> <p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px'>76984</p><span>Thank You!</span> </div> </body></html>"
|
||||
});
|
||||
console.log('Res');
|
||||
console.log(res);
|
||||
return otp;
|
||||
} catch (err) {
|
||||
console.log('err in SendMailv1');
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
export default SendMailv1;
|
||||
+32
-29
@@ -48,10 +48,12 @@ async function sendCompletedMail(e) {
|
||||
var a = e.url,
|
||||
t = e.sender,
|
||||
s = e.pdfName,
|
||||
a = {
|
||||
r = e.receiver,
|
||||
e = {
|
||||
extUserId: e.extUserId,
|
||||
url: a,
|
||||
from: 'OpenSign™',
|
||||
recipient: e.receiver,
|
||||
recipient: r,
|
||||
subject: `Document ${s} has been signed by all parties`,
|
||||
pdfName: s,
|
||||
html:
|
||||
@@ -61,7 +63,7 @@ async function sendCompletedMail(e) {
|
||||
t.Mail +
|
||||
' directly. If you think this email is inappropriate or spam, you may file a complaint with OpenSign™ <a href=www.opensignlabs.com target=_blank>here</a>.</p></div></div></body></html>',
|
||||
};
|
||||
await axios.post(serverUrl + '/functions/sendmailv3', a, {
|
||||
await axios.post(serverUrl + '/functions/sendmailv3', e, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Parse-Application-Id': APPID,
|
||||
@@ -206,11 +208,11 @@ async function PDF(i) {
|
||||
var P,
|
||||
y,
|
||||
v,
|
||||
b,
|
||||
U,
|
||||
b,
|
||||
I,
|
||||
S = `exported_file_${Math.floor(5e3 * Math.random())}.pdf`,
|
||||
A = './exports/' + S;
|
||||
x = './exports/' + S;
|
||||
let s = e.length;
|
||||
s = (
|
||||
t
|
||||
@@ -226,51 +228,52 @@ async function PDF(i) {
|
||||
}),
|
||||
(v = await y.save()),
|
||||
Buffer.from(v))
|
||||
: ((b = await PDFDocument.load(e)),
|
||||
: ((U = await PDFDocument.load(e)),
|
||||
pdflibAddPlaceholder({
|
||||
pdfDoc: b,
|
||||
pdfDoc: U,
|
||||
reason: 'Digitally signed by OpenSign for ' + p + ' <' + m + '>',
|
||||
location: 'location',
|
||||
signatureLength: 15e3,
|
||||
}),
|
||||
(U = await b.save()),
|
||||
Buffer.from(U))),
|
||||
(b = await U.save()),
|
||||
Buffer.from(b))),
|
||||
(I = await new SignPDF(e, u).signPDF()),
|
||||
fs.writeFileSync(A, I),
|
||||
fs.writeFileSync(x, I),
|
||||
I)
|
||||
: (fs.writeFileSync(A, e), e)
|
||||
: (fs.writeFileSync(x, e), e)
|
||||
).length;
|
||||
var w,
|
||||
D,
|
||||
x = await uploadFile(S, A);
|
||||
if (x && x.imageUrl)
|
||||
var A,
|
||||
w,
|
||||
D = await uploadFile(S, x);
|
||||
if (D && D.imageUrl)
|
||||
return (
|
||||
(w = await updateDoc(
|
||||
(A = await updateDoc(
|
||||
i.params.docId,
|
||||
x.imageUrl,
|
||||
D.imageUrl,
|
||||
r.data.results[0].objectId,
|
||||
i.headers['x-real-ip'],
|
||||
n.data,
|
||||
o
|
||||
)),
|
||||
sendDoctoWebhook(n, x.imageUrl, 'signed', r?.data.results?.[0]),
|
||||
saveFileUsage(s, x.imageUrl, d.data.objectId),
|
||||
w &&
|
||||
w.isCompleted &&
|
||||
((D = {
|
||||
url: x.imageUrl,
|
||||
sendDoctoWebhook(n, D.imageUrl, 'signed', r?.data.results?.[0]),
|
||||
saveFileUsage(s, D.imageUrl, d.data.objectId),
|
||||
A &&
|
||||
A.isCompleted &&
|
||||
((w = {
|
||||
url: D.imageUrl,
|
||||
sender: { Mail: n.data.ExtUserPtr.Email, Name: 'OpenSign™' },
|
||||
pdfName: n.data.Name,
|
||||
receiver: n.data.ExtUserPtr.Email,
|
||||
extUserId: n.data.ExtUserPtr.objectId,
|
||||
}),
|
||||
n.data.IsSendMail && !1 === n.data.IsSendMail
|
||||
? console.log("don't send mail")
|
||||
: sendCompletedMail(D),
|
||||
sendDoctoWebhook(n, x.imageUrl, 'completed')),
|
||||
fs.unlinkSync(A),
|
||||
console.log('New Signed PDF created called: ' + A),
|
||||
'success' === w.message
|
||||
? { status: 'success', data: x.imageUrl }
|
||||
: sendCompletedMail(w),
|
||||
sendDoctoWebhook(n, D.imageUrl, 'completed')),
|
||||
fs.unlinkSync(x),
|
||||
console.log('New Signed PDF created called: ' + x),
|
||||
'success' === A.message
|
||||
? { status: 'success', data: D.imageUrl }
|
||||
: { status: 'error', message: 'please provide required parameters!' }
|
||||
);
|
||||
}
|
||||
|
||||
+16
-3
@@ -3,8 +3,9 @@ import https from 'https';
|
||||
import formData from 'form-data';
|
||||
import Mailgun from 'mailgun.js';
|
||||
import { createTransport } from 'nodemailer';
|
||||
import { updateMailCount } from '../../Utils.js';
|
||||
|
||||
async function sendmail(req) {
|
||||
async function sendmailv3(req) {
|
||||
try {
|
||||
let transporterSMTP;
|
||||
let mailgunClient;
|
||||
@@ -77,6 +78,9 @@ async function sendmail(req) {
|
||||
const res = await transporterSMTP.sendMail(messageParams);
|
||||
console.log('Res ', res);
|
||||
if (!res.err) {
|
||||
if (req.params?.extUserId) {
|
||||
await updateMailCount(req.params.extUserId);
|
||||
}
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
@@ -85,6 +89,9 @@ async function sendmail(req) {
|
||||
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
|
||||
console.log('Res ', res);
|
||||
if (res.status === 200) {
|
||||
if (req.params?.extUserId) {
|
||||
await updateMailCount(req.params.extUserId);
|
||||
}
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
@@ -109,6 +116,9 @@ async function sendmail(req) {
|
||||
const res = await transporterSMTP.sendMail(messageParams);
|
||||
console.log('Res ', res);
|
||||
if (!res.err) {
|
||||
if (req.params?.extUserId) {
|
||||
await updateMailCount(req.params.extUserId);
|
||||
}
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
@@ -117,6 +127,9 @@ async function sendmail(req) {
|
||||
const res = await mailgunClient.messages.create(mailgunDomain, messageParams);
|
||||
console.log('Res ', res);
|
||||
if (res.status === 200) {
|
||||
if (req.params?.extUserId) {
|
||||
await updateMailCount(req.params.extUserId);
|
||||
}
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
@@ -124,11 +137,11 @@ async function sendmail(req) {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('err ', err);
|
||||
console.log('err in sendmailv3', err);
|
||||
if (err) {
|
||||
return { status: 'error' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default sendmail;
|
||||
export default sendmailv3;
|
||||
@@ -86,7 +86,9 @@ if (process.env.SMTP_ENABLE) {
|
||||
console.log('Please provide valid Mailgun credentials');
|
||||
}
|
||||
}
|
||||
|
||||
const mailsender = process.env.SMTP_ENABLE
|
||||
? process.env.SMTP_USER_EMAIL
|
||||
: process.env.MAILGUN_SENDER;
|
||||
export const config = {
|
||||
databaseURI:
|
||||
process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',
|
||||
@@ -102,7 +104,7 @@ export const config = {
|
||||
verifyUserEmails: isMailAdapter === true ? true : false,
|
||||
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
|
||||
// Your apps name. This will appear in the subject and body of the emails that are sent.
|
||||
appName: 'Open Sign',
|
||||
appName: 'Opensign',
|
||||
allowClientClassCreation: false,
|
||||
allowExpiredAuthDataToken: false,
|
||||
encodeParseObjectInCloudFunction: true,
|
||||
@@ -112,9 +114,7 @@ export const config = {
|
||||
module: 'parse-server-api-mail-adapter',
|
||||
options: {
|
||||
// The email address from which emails are sent.
|
||||
sender: process.env.SMTP_ENABLE
|
||||
? process.env.SMTP_USER_EMAIL
|
||||
: process.env.MAILGUN_SENDER,
|
||||
sender: 'Opensign™' + ' <' + mailsender + '>',
|
||||
// The email templates.
|
||||
templates: {
|
||||
// The template used by Parse Server to send an email for password
|
||||
|
||||
Reference in New Issue
Block a user