mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
fix: resolve user not able to login/signup (#195)
This commit is contained in:
@@ -49,12 +49,9 @@ const TreeWidget = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
var emp = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
var q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
res = await q.first();
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
if (res) {
|
||||
@@ -79,12 +76,9 @@ const TreeWidget = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
emp = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
res = await q.first();
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
|
||||
@@ -121,10 +115,15 @@ const TreeWidget = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
emp = Parse.Object.extend(localStorage.getItem("extended_class"));
|
||||
q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
res = await q.first();
|
||||
// emp = Parse.Object.extend(localStorage.getItem("extended_class"));
|
||||
// q = new Parse.Query(emp);
|
||||
// q.equalTo("UserId", currentUser);
|
||||
// res = await q.first();
|
||||
// if (res) res = res.toJSON();
|
||||
const currentUser = Parse.User.current();
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
|
||||
@@ -532,7 +531,7 @@ const TreeWidget = (props) => {
|
||||
padding: 0
|
||||
},
|
||||
overlay: {
|
||||
width:"100%",
|
||||
width: "100%",
|
||||
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
||||
zIndex: 50
|
||||
}
|
||||
|
||||
@@ -35,14 +35,9 @@ const DashboardCard = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
var emp = Parse.Object.extend(localStorage.getItem("extended_class"));
|
||||
var q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", {
|
||||
__type: "Pointer",
|
||||
className: "_User",
|
||||
objectId: currentUser
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
res = await q.first();
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
if (res) {
|
||||
@@ -110,13 +105,17 @@ const DashboardCard = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
resr = data[0];
|
||||
} else {
|
||||
let emp = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
let q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
let t = await q.first();
|
||||
resr = t.toJSON();
|
||||
// let emp = Parse.Object.extend(
|
||||
// localStorage.getItem("extended_class")
|
||||
// );
|
||||
// let q = new Parse.Query(emp);
|
||||
// q.equalTo("UserId", currentUser);
|
||||
// let t = await q.first();
|
||||
// resr = t.toJSON();
|
||||
resr = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (resr) resr = resr.toJSON();
|
||||
}
|
||||
|
||||
let json = resr;
|
||||
@@ -227,13 +226,17 @@ const DashboardCard = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
var emp = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
var q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
let resr = await q.first();
|
||||
res = resr.toJSON();
|
||||
// var emp = Parse.Object.extend(
|
||||
// localStorage.getItem("extended_class")
|
||||
// );
|
||||
// var q = new Parse.Query(emp);
|
||||
// q.equalTo("UserId", currentUser);
|
||||
// let resr = await q.first();
|
||||
// res = resr.toJSON();
|
||||
let resr = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (res) res = resr.toJSON();
|
||||
}
|
||||
|
||||
let json = res;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { Component } from "react";
|
||||
import Parse from "parse";
|
||||
import axios from "axios";
|
||||
// import axios from "axios";
|
||||
|
||||
export class HiddenField extends Component {
|
||||
state = {
|
||||
@@ -37,31 +37,46 @@ export class HiddenField extends Component {
|
||||
this.setState({ _fields: custome_Filed });
|
||||
} else {
|
||||
if (currentUser) {
|
||||
let url = `${this.state.baseUrl}classes/${localStorage.getItem(
|
||||
"extended_class"
|
||||
)}?where={"UserId":{"__type":"Pointer","className":"_User","objectId":"${
|
||||
currentUser.id
|
||||
}"}}&keys=${this.props.schema.data.valueKey}`;
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": this.state.parseAppId
|
||||
};
|
||||
await axios.get(url, { headers: headers }).then((res) => {
|
||||
let custome_Filed = "";
|
||||
let _rdata = res.data.results;
|
||||
let splitArray = this.props.schema.data.valueKey.split(".");
|
||||
if (splitArray.length > 1) {
|
||||
custome_Filed = _rdata[0][splitArray[0]][splitArray[1]];
|
||||
} else {
|
||||
console.log(_rdata[0][splitArray[0]]);
|
||||
custome_Filed = _rdata[0][splitArray[0]];
|
||||
}
|
||||
this.setState({ _fields: custome_Filed });
|
||||
// let url = `${this.state.baseUrl}classes/${localStorage.getItem(
|
||||
// "extended_class"
|
||||
// )}?where={"UserId":{"__type":"Pointer","className":"_User","objectId":"${
|
||||
// currentUser.id
|
||||
// }"}}&keys=${this.props.schema.data.valueKey}`;
|
||||
// const headers = {
|
||||
// "Content-Type": "application/json",
|
||||
// "X-Parse-Application-Id": this.state.parseAppId
|
||||
// };
|
||||
// await axios.get(url, { headers: headers }).then((res) => {
|
||||
// let custome_Filed = "";
|
||||
// let _rdata = res.data.results;
|
||||
// let splitArray = this.props.schema.data.valueKey.split(".");
|
||||
// if (splitArray.length > 1) {
|
||||
// custome_Filed = _rdata[0][splitArray[0]][splitArray[1]];
|
||||
// } else {
|
||||
// console.log(_rdata[0][splitArray[0]]);
|
||||
// custome_Filed = _rdata[0][splitArray[0]];
|
||||
// }
|
||||
// this.setState({ _fields: custome_Filed });
|
||||
// });
|
||||
|
||||
const res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
let custome_Filed = "";
|
||||
const result = res.toJSON();
|
||||
let _rdata = [result];
|
||||
let splitArray = this.props.schema.data.valueKey.split(".");
|
||||
if (splitArray.length > 1) {
|
||||
custome_Filed = _rdata[0][splitArray[0]][splitArray[1]];
|
||||
} else {
|
||||
console.log(_rdata[0][splitArray[0]]);
|
||||
custome_Filed = _rdata[0][splitArray[0]];
|
||||
}
|
||||
this.setState({ _fields: custome_Filed });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('err', error)
|
||||
console.log("err", error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -120,12 +120,10 @@ const Level1Dropdown = (props) => {
|
||||
let data = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
res = data[0];
|
||||
} else {
|
||||
var emp = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
var q = new Parse.Query(emp);
|
||||
q.equalTo("UserId", currentUser);
|
||||
res = await q.first();
|
||||
const currentUser = Parse.User.current();
|
||||
res = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
if (res) res = res.toJSON();
|
||||
}
|
||||
|
||||
@@ -339,7 +337,7 @@ const Level1Dropdown = (props) => {
|
||||
x.className = x.className.replace("show", "");
|
||||
}, 5000);
|
||||
} catch (error) {
|
||||
console.log("Err", error)
|
||||
console.log("Err", error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useWindowSize } from "../hook/useWindowSize";
|
||||
import Tour from "reactour";
|
||||
import axios from "axios";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import Parse from "parse";
|
||||
const HomeLayout = ({ children }) => {
|
||||
const { width } = useWindowSize();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -124,20 +124,11 @@ const HomeLayout = ({ children }) => {
|
||||
};
|
||||
|
||||
async function checkTourStatus() {
|
||||
const serverUrl = localStorage.getItem("baseUrl");
|
||||
const appId = localStorage.getItem("AppID12");
|
||||
const extUserClass = localStorage.getItem("extended_class");
|
||||
const json = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||
const extUserId = json && json.length > 0 && json[0].objectId;
|
||||
// console.log("extUserId ", extUserId);
|
||||
const res = await axios.get(
|
||||
serverUrl + "classes/" + extUserClass + "/" + extUserId,
|
||||
{
|
||||
headers: {
|
||||
"X-Parse-Application-Id": appId
|
||||
}
|
||||
}
|
||||
);
|
||||
const currentUser = Parse.User.current();
|
||||
const cloudRes = await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
});
|
||||
const res = { data: cloudRes.toJSON() };
|
||||
if (res.data && res.data.TourStatus && res.data.TourStatus.length > 0) {
|
||||
const tourStatus = res.data.TourStatus;
|
||||
// console.log("res ", res.data.TourStatus);
|
||||
|
||||
@@ -11,7 +11,8 @@ export const fetchAppInfo = (str, burl, app_id) => async (dispatch) => {
|
||||
let _base = ""; // Define _base here and initialize it to an empty string
|
||||
if (response && response.baseurl) {
|
||||
_base = response.baseurl.charAt(response.baseurl.length - 1);
|
||||
} localStorage.removeItem("baseUrl");
|
||||
}
|
||||
localStorage.removeItem("baseUrl");
|
||||
localStorage.setItem("_appName", response.appname);
|
||||
localStorage.setItem("_app_objectId", response.objectId);
|
||||
if (_base === "/") {
|
||||
@@ -120,16 +121,11 @@ export const login = (username, password) => async (dispatch) => {
|
||||
localStorage.setItem("_user_role", _role);
|
||||
}
|
||||
try {
|
||||
const tour = Parse.Object.extend(
|
||||
localStorage.getItem("extended_class")
|
||||
);
|
||||
let _tour = new Parse.Query(tour);
|
||||
_tour.equalTo("UserId", {
|
||||
__type: "Pointer",
|
||||
className: "_User",
|
||||
objectId: resultjson.objectId
|
||||
});
|
||||
await _tour.first().then(
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
})
|
||||
.then(
|
||||
(results) => {
|
||||
let userinfo = results.toJSON();
|
||||
if (userinfo.TenantId) {
|
||||
@@ -142,7 +138,7 @@ export const login = (username, password) => async (dispatch) => {
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.log("err ", error)
|
||||
console.log("err ", error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,15 +162,13 @@ function Login(props) {
|
||||
element.userpointer
|
||||
);
|
||||
|
||||
const extendedClass = Parse.Object.extend(
|
||||
element.extended_class
|
||||
);
|
||||
let query = new Parse.Query(extendedClass);
|
||||
query.equalTo("UserId", Parse.User.current());
|
||||
query.include("TenantId");
|
||||
await query.find().then(
|
||||
(results) => {
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(result) => {
|
||||
let tenentInfo = [];
|
||||
const results = [result];
|
||||
if (results) {
|
||||
let extendedInfo_stringify =
|
||||
JSON.stringify(results);
|
||||
@@ -280,10 +278,14 @@ function Login(props) {
|
||||
`/${element.pageType}/${element.pageId}`
|
||||
);
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, {
|
||||
replace: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, {
|
||||
replace: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigate(
|
||||
@@ -320,7 +322,9 @@ function Login(props) {
|
||||
);
|
||||
const billingDate = "";
|
||||
if (billingDate) {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, {
|
||||
replace: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigate(
|
||||
@@ -586,10 +590,12 @@ function Login(props) {
|
||||
`/${element.pageType}/${element.pageId}`
|
||||
);
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, {
|
||||
replace: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, { replace: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,10 +616,10 @@ function Login(props) {
|
||||
`/${element.pageType}/${element.pageId}`
|
||||
);
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, { replace: true });
|
||||
}
|
||||
} else {
|
||||
navigate(`/subscription`);
|
||||
navigate(`/subscription`, { replace: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -750,15 +756,21 @@ function Login(props) {
|
||||
element.extended_class
|
||||
);
|
||||
|
||||
const extendedClass = Parse.Object.extend(
|
||||
element.extended_class
|
||||
);
|
||||
let query = new Parse.Query(extendedClass);
|
||||
query.equalTo("UserId", Parse.User.current());
|
||||
query.include("TenantId");
|
||||
await query.find().then(
|
||||
(results) => {
|
||||
// const extendedClass = Parse.Object.extend(
|
||||
// element.extended_class
|
||||
// );
|
||||
// let query = new Parse.Query(extendedClass);
|
||||
// query.equalTo("UserId", Parse.User.current());
|
||||
// query.include("TenantId");
|
||||
// await query.find()
|
||||
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(result) => {
|
||||
let tenentInfo = [];
|
||||
const results = [result];
|
||||
if (results) {
|
||||
let extendedInfo_stringify = JSON.stringify(results);
|
||||
let extendedInfo = JSON.parse(extendedInfo_stringify);
|
||||
@@ -1154,7 +1166,9 @@ function Login(props) {
|
||||
<div className="modal-dialog" role="document">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h5 className="modal-title font-semibold">Additional Info</h5>
|
||||
<h5 className="modal-title font-semibold">
|
||||
Additional Info
|
||||
</h5>
|
||||
<span>
|
||||
<span></span>
|
||||
</span>
|
||||
|
||||
@@ -285,14 +285,12 @@ const PgSignUp = (props) => {
|
||||
);
|
||||
localStorage.setItem("userpointer", element.userpointer);
|
||||
|
||||
const extendedClass = Parse.Object.extend(
|
||||
element.extended_class
|
||||
);
|
||||
let query = new Parse.Query(extendedClass);
|
||||
query.equalTo("UserId", Parse.User.current());
|
||||
query.include("TenantId");
|
||||
await query.find().then(
|
||||
(results) => {
|
||||
const currentUser = Parse.User.current();
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: currentUser.get("email")
|
||||
}).then(
|
||||
(result) => {
|
||||
const results = [result];
|
||||
let tenentInfo = [];
|
||||
if (results) {
|
||||
let extendedInfo_stringify =
|
||||
@@ -407,7 +405,7 @@ const PgSignUp = (props) => {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('err', err)
|
||||
console.log("err", err);
|
||||
setIsLoader(false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -207,13 +207,6 @@ const Signup = (props) => {
|
||||
""
|
||||
);
|
||||
localStorage.setItem("_user_role", _role);
|
||||
|
||||
if (element.enableCart) {
|
||||
localStorage.setItem("EnableCart", element.enableCart);
|
||||
props.setEnableCart(element.enableCart);
|
||||
} else {
|
||||
localStorage.removeItem("EnableCart");
|
||||
}
|
||||
// Get TenentID from Extendend Class
|
||||
localStorage.setItem(
|
||||
"extended_class",
|
||||
@@ -221,15 +214,12 @@ const Signup = (props) => {
|
||||
);
|
||||
localStorage.setItem("userpointer", element.userpointer);
|
||||
|
||||
const extendedClass = Parse.Object.extend(
|
||||
element.extended_class
|
||||
);
|
||||
let query = new Parse.Query(extendedClass);
|
||||
query.equalTo("UserId", Parse.User.current());
|
||||
query.include("TenantId");
|
||||
await query.find().then(
|
||||
(results) => {
|
||||
await Parse.Cloud.run("getUserDetails", {
|
||||
email: email
|
||||
}).then(
|
||||
(result) => {
|
||||
let tenentInfo = [];
|
||||
const results = [result];
|
||||
if (results) {
|
||||
let extendedInfo_stringify =
|
||||
JSON.stringify(results);
|
||||
@@ -317,7 +307,7 @@ const Signup = (props) => {
|
||||
);
|
||||
setState({ loading: false });
|
||||
if (process.env.REACT_APP_ENABLE_SUBSCRIPTION) {
|
||||
navigate("/subscription");
|
||||
navigate(`/subscription`, { replace: true });
|
||||
} else {
|
||||
alert("Registered user successfully");
|
||||
navigate(
|
||||
@@ -335,7 +325,7 @@ const Signup = (props) => {
|
||||
localStorage.setItem("pageType", element.pageType);
|
||||
setState({ loading: false });
|
||||
if (process.env.REACT_APP_ENABLE_SUBSCRIPTION) {
|
||||
navigate("/subscription");
|
||||
navigate(`/subscription`, { replace: true });
|
||||
} else {
|
||||
navigate(
|
||||
`/${element.pageType}/${element.pageId}`
|
||||
|
||||
@@ -2,6 +2,8 @@ async function getUserDetails(request) {
|
||||
try {
|
||||
const userQuery = new Parse.Query('contracts_Users');
|
||||
userQuery.equalTo('Email', request.params.email);
|
||||
userQuery.include('TenantId');
|
||||
userQuery.include('UserId')
|
||||
const res = await userQuery.first({ useMasterKey: true });
|
||||
return res;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user