Skip to content

Commit

Permalink
Merge pull request #688 from OpenSignLabs/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
nxglabs authored May 7, 2024
2 parents c564b57 + ff9a495 commit a6d97d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
6 changes: 3 additions & 3 deletions apps/OpenSign/src/components/LoginGoogle.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ const GoogleSignInBtn = ({
// console.log("payload ", payload);
if (payload && payload.sessiontoken) {
// setThirdpartyLoader(true);
const billingDate =
extRes.get("Next_billing_date") && extRes.get("Next_billing_date");
// const billingDate =
// extRes.get("Next_billing_date") && extRes.get("Next_billing_date");
// console.log("billingDate expired", billingDate > new Date());
const LocalUserDetails = {
name: details.Name,
Expand All @@ -125,7 +125,7 @@ const GoogleSignInBtn = ({
company: extRes.get("Company")
};
localStorage.setItem("userDetails", JSON.stringify(LocalUserDetails));
thirdpartyLoginfn(payload.sessiontoken, billingDate);
thirdpartyLoginfn(payload.sessiontoken);
}
return { msg: "exist" };
} else {
Expand Down
24 changes: 17 additions & 7 deletions apps/OpenSign/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ function Login() {
alert("Somenthing went wrong, please try again later!");
}
};
const thirdpartyLoginfn = async (sessionToken, billingDate) => {
const thirdpartyLoginfn = async (sessionToken) => {
const baseUrl = localStorage.getItem("baseUrl");
const parseAppId = localStorage.getItem("parseAppId");
const res = await axios.get(baseUrl + "users/me", {
Expand Down Expand Up @@ -521,7 +521,7 @@ function Login() {
await Parse.Cloud.run("getUserDetails", {
email: currentUser.get("email")
}).then(
(result) => {
async (result) => {
let tenentInfo = [];
const results = [result];
if (results) {
Expand Down Expand Up @@ -571,7 +571,7 @@ function Login() {
setState({ ...state, loading: false });
navigate("/");
} else {
extendedInfo.forEach((x) => {
extendedInfo.forEach(async (x) => {
if (x.TenantId) {
let obj = {
tenentId: x.TenantId.objectId,
Expand Down Expand Up @@ -608,8 +608,13 @@ function Login() {
setThirdpartyLoader(false);
setState({ ...state, loading: false });
if (isEnableSubscription) {
if (billingDate) {
if (billingDate > new Date()) {
const res = await fetchSubscription();
const freeplan = res.plan;
const billingDate = res.billingDate;
if (freeplan === "freeplan") {
navigate(redirectUrl);
} else if (billingDate) {
if (new Date(billingDate) > new Date()) {
localStorage.removeItem("userDetails");
navigate(redirectUrl);
} else {
Expand Down Expand Up @@ -644,8 +649,13 @@ function Login() {
setState({ ...state, loading: false });
setThirdpartyLoader(false);
if (isEnableSubscription) {
if (billingDate) {
if (billingDate > new Date()) {
const res = await fetchSubscription();
const freeplan = res.plan;
const billingDate = res.billingDate;
if (freeplan === "freeplan") {
navigate(redirectUrl);
} else if (billingDate) {
if (new Date(billingDate) > new Date()) {
localStorage.removeItem("userDetails");
// Redirect to the appropriate URL after successful login
navigate(redirectUrl);
Expand Down

0 comments on commit a6d97d5

Please sign in to comment.