Overwrite subscriber ID in thanks page
This commit is contained in:
parent
cf6729603e
commit
0f262dea5a
@ -1,5 +1,7 @@
|
|||||||
export const WALLET_DISCLAIMER_MSG = 'You are connecting to an experimental wallet! It is not secure. Do not use it elsewhere and/or for managing real assets.'
|
export const WALLET_DISCLAIMER_MSG = 'You are connecting to an experimental wallet! It is not secure. Do not use it elsewhere and/or for managing real assets.';
|
||||||
|
|
||||||
export const REDIRECT_EMAIL_MSG = 'Close this tab and the confirmation link in your email will bring you back to the onboarding app.'
|
export const REDIRECT_EMAIL_MSG = 'Close this tab and the confirmation link in your email will bring you back to the onboarding app.';
|
||||||
|
|
||||||
export const ENABLE_KYC = false;
|
export const ENABLE_KYC = false;
|
||||||
|
|
||||||
|
export const SUBSCRIBER_ID_HASH_KEY = 'subscriberIdHash';
|
||||||
|
@ -15,7 +15,9 @@ const ConnectWallet = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
navigate("/sign-with-nitro-key");
|
navigate("/sign-with-nitro-key", {
|
||||||
|
state: location.state
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [session, navigate, location]);
|
}, [session, navigate, location]);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import SumsubWebSdk from "@sumsub/websdk-react";
|
|||||||
import { MessageHandler } from "@sumsub/websdk";
|
import { MessageHandler } from "@sumsub/websdk";
|
||||||
|
|
||||||
import { config, fetchAccessToken, getAccessTokenExpirationHandler, options } from "../utils/sumsub";
|
import { config, fetchAccessToken, getAccessTokenExpirationHandler, options } from "../utils/sumsub";
|
||||||
import { ENABLE_KYC } from "../constants";
|
import { ENABLE_KYC, SUBSCRIBER_ID_HASH_KEY } from "../constants";
|
||||||
|
|
||||||
interface Participant {
|
interface Participant {
|
||||||
cosmosAddress: string;
|
cosmosAddress: string;
|
||||||
@ -48,7 +48,7 @@ const OnboardingSuccess = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.removeItem('subscriberIdHash');
|
localStorage.removeItem(SUBSCRIBER_ID_HASH_KEY);
|
||||||
|
|
||||||
setParticipant(participant);
|
setParticipant(participant);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -12,6 +12,7 @@ import { StargateClient } from "@cosmjs/stargate";
|
|||||||
|
|
||||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||||
import SelectRoleCard, {Role} from "../components/SelectRoleCard";
|
import SelectRoleCard, {Role} from "../components/SelectRoleCard";
|
||||||
|
import { SUBSCRIBER_ID_HASH_KEY } from "../constants";
|
||||||
|
|
||||||
const SignWithCosmos = () => {
|
const SignWithCosmos = () => {
|
||||||
const { session, signClient } = useWalletConnectContext();
|
const { session, signClient } = useWalletConnectContext();
|
||||||
@ -35,7 +36,7 @@ const SignWithCosmos = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ethAddress = innerMessage!.address;
|
const ethAddress = innerMessage!.address;
|
||||||
const subscriberIdHash = localStorage.getItem('subscriberIdHash');
|
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
||||||
|
|
||||||
const createCosmosClient = useCallback(async (endpoint: string) => {
|
const createCosmosClient = useCallback(async (endpoint: string) => {
|
||||||
return await StargateClient.connect(endpoint);
|
return await StargateClient.connect(endpoint);
|
||||||
|
@ -13,7 +13,7 @@ import LoadingButton from '@mui/lab/LoadingButton';
|
|||||||
import { utf8ToHex } from "@walletconnect/encoding";
|
import { utf8ToHex } from "@walletconnect/encoding";
|
||||||
|
|
||||||
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
import { useWalletConnectContext } from "../context/WalletConnectContext";
|
||||||
import { ENABLE_KYC } from "../constants";
|
import { ENABLE_KYC, SUBSCRIBER_ID_HASH_KEY } from "../constants";
|
||||||
|
|
||||||
const SignWithNitroKey = () => {
|
const SignWithNitroKey = () => {
|
||||||
|
|
||||||
@ -34,14 +34,12 @@ const SignWithNitroKey = () => {
|
|||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const subscriberIdHash = localStorage.getItem('subscriberIdHash');
|
const subscriberIdHash = localStorage.getItem(SUBSCRIBER_ID_HASH_KEY);
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
if(!subscriberIdHash){
|
if(!subscriberIdHash){
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
enqueueSnackbar("Subscriber ID not found. Please verify your email and try again", { variant: "error" });
|
||||||
}
|
}
|
||||||
}, [subscriberIdHash])
|
|
||||||
|
|
||||||
const message = useMemo(() => {
|
const message = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -4,6 +4,7 @@ import { jwtDecode } from "jwt-decode";
|
|||||||
import { ethers } from 'ethers';
|
import { ethers } from 'ethers';
|
||||||
|
|
||||||
import { Box, colors, Typography } from '@mui/material';
|
import { Box, colors, Typography } from '@mui/material';
|
||||||
|
import { SUBSCRIBER_ID_HASH_KEY } from '../constants';
|
||||||
|
|
||||||
interface JwtPayload {
|
interface JwtPayload {
|
||||||
subscriber_id: string;
|
subscriber_id: string;
|
||||||
@ -19,11 +20,6 @@ const Thanks: React.FC = () => {
|
|||||||
const [err, setErr] = useState<string>();
|
const [err, setErr] = useState<string>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const localSubscriberIdHash = localStorage.getItem('localSubscriberIdHash');
|
|
||||||
if(localSubscriberIdHash){
|
|
||||||
navigate('/connect-wallet');
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryParams = new URLSearchParams(location.search);
|
const queryParams = new URLSearchParams(location.search);
|
||||||
const token = queryParams.get('jwt_token');
|
const token = queryParams.get('jwt_token');
|
||||||
|
|
||||||
@ -46,7 +42,7 @@ const Thanks: React.FC = () => {
|
|||||||
const subscriberIdBytes = ethers.utils.toUtf8Bytes(decoded.subscriber_id);
|
const subscriberIdBytes = ethers.utils.toUtf8Bytes(decoded.subscriber_id);
|
||||||
const subscriberIdHash = ethers.utils.sha256(subscriberIdBytes);
|
const subscriberIdHash = ethers.utils.sha256(subscriberIdBytes);
|
||||||
|
|
||||||
localStorage.setItem('subscriberIdHash', subscriberIdHash);
|
localStorage.setItem(SUBSCRIBER_ID_HASH_KEY, subscriberIdHash);
|
||||||
|
|
||||||
navigate('/connect-wallet');
|
navigate('/connect-wallet');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -45,13 +45,13 @@ const UserVerification = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (applicationSubmitted && kycId !== '') {
|
if (applicationSubmitted && kycId !== '') {
|
||||||
const kycIdHash = ethers.utils.sha256(ethers.utils.toUtf8Bytes(kycId));
|
const kycIdHash = ethers.utils.sha256(ethers.utils.toUtf8Bytes(kycId));
|
||||||
localStorage.setItem('subscriberIdHash', kycIdHash);
|
|
||||||
|
|
||||||
navigate("/sign-with-cosmos", {
|
navigate("/sign-with-cosmos", {
|
||||||
state: {
|
state: {
|
||||||
message,
|
message,
|
||||||
cosmosAddress,
|
cosmosAddress,
|
||||||
receivedEthSig,
|
receivedEthSig,
|
||||||
|
kycIdHash
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
}, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]);
|
}, [applicationSubmitted, kycId, navigate, cosmosAddress, message, receivedEthSig]);
|
||||||
|
Loading…
Reference in New Issue
Block a user