Skip to content

Commit b218e96

Browse files
authored
Merge pull request #802 from OpenSignLabs/fix_email
2 parents 3ede441 + 64a0be8 commit b218e96

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import DefaultSignature from "../components/pdf/DefaultSignature";
4141
import ModalUi from "../primitives/ModalUi";
4242
import VerifyEmail from "../components/pdf/VerifyEmail";
4343
import TourContentWithBtn from "../primitives/TourContentWithBtn";
44+
import { appInfo } from "../constant/appinfo";
4445
function useQuery() {
4546
return new URLSearchParams(useLocation().search);
4647
}
@@ -164,18 +165,26 @@ function PdfRequestFiles() {
164165
const handleResend = async (e) => {
165166
e.preventDefault();
166167
setOtpLoader(true);
167-
await handleSendOTP(Parse.User.current().getEmail());
168+
const localuser = localStorage.getItem(
169+
`Parse/${appInfo.appId}/currentUser`
170+
);
171+
const currentUser = JSON.parse(JSON.stringify(localuser));
172+
await handleSendOTP(currentUser?.email);
168173
setOtpLoader(false);
169174
alert("OTP sent on you email");
170175
};
171176
//`handleVerifyEmail` function is used to verify email with otp
172177
const handleVerifyEmail = async (e) => {
173178
e.preventDefault();
174179
setOtpLoader(true);
180+
const localuser = localStorage.getItem(
181+
`Parse/${appInfo.appId}/currentUser`
182+
);
183+
const currentUser = JSON.parse(JSON.stringify(localuser));
175184
try {
176185
const resEmail = await Parse.Cloud.run("verifyemail", {
177186
otp: otp,
178-
email: Parse.User.current().getEmail()
187+
email: currentUser?.email
179188
});
180189
if (resEmail?.message === "Email is verified.") {
181190
setIsEmailVerified(true);
@@ -196,7 +205,11 @@ function PdfRequestFiles() {
196205
//`handleVerifyBtn` function is used to send otp on user mail
197206
const handleVerifyBtn = async () => {
198207
setIsVerifyModal(true);
199-
await handleSendOTP(Parse.User.current().getEmail());
208+
const localuser = localStorage.getItem(
209+
`Parse/${appInfo.appId}/currentUser`
210+
);
211+
const currentUser = JSON.parse(JSON.stringify(localuser));
212+
await handleSendOTP(currentUser?.email);
200213
};
201214
async function checkIsSubscribed(extUserId, contactId) {
202215
const isGuestSign = location.pathname.includes("/load/") || false;
@@ -460,8 +473,11 @@ function PdfRequestFiles() {
460473
} else {
461474
//else condition to check current user exist in contracts_Users class and check tour message status
462475
//if not then check user exist in contracts_Contactbook class and check tour message status
463-
const currentUser = JSON.parse(JSON.stringify(Parse.User.current()));
464-
const currentUserEmail = currentUser.email;
476+
const localuser = localStorage.getItem(
477+
`Parse/${appInfo.appId}/currentUser`
478+
);
479+
const currentUser = JSON.parse(JSON.stringify(localuser));
480+
const currentUserEmail = currentUser?.email;
465481
const res = await contractUsers(currentUserEmail);
466482
if (res === "Error: Something went wrong!") {
467483
setHandleError("Error: Something went wrong!");

0 commit comments

Comments
 (0)