Commit aeb16995 authored by adadachao's avatar adadachao

up -- Invalid reCAPTCHA response

parent ece6b65d
...@@ -48,7 +48,12 @@ const ExportCSV = ({ filters }: Props) => { ...@@ -48,7 +48,12 @@ const ExportCSV = ({ filters }: Props) => {
try { try {
setIsLoading(true); setIsLoading(true);
const response = await recaptcha.fetchProtectedResource(apiFetchFactory); // const response = await recaptcha.fetchProtectedResource(apiFetchFactory);
const token = await recaptcha.executeAsync();
if (!token) {
throw new Error('ReCaptcha is not solved');
}
const response = await recaptcha.fetchProtectedResource(apiFetchFactory, token);
const blob = await response.blob(); const blob = await response.blob();
const fileName = `export-filtered-txs-${ dayjs().format('YYYY-MM-DD-HH-mm-ss') }.csv`; const fileName = `export-filtered-txs-${ dayjs().format('YYYY-MM-DD-HH-mm-ss') }.csv`;
......
...@@ -60,7 +60,12 @@ const MyProfileEmail = ({ profileQuery }: Props) => { ...@@ -60,7 +60,12 @@ const MyProfileEmail = ({ profileQuery }: Props) => {
const onFormSubmit: SubmitHandler<FormFields> = React.useCallback(async(formData) => { const onFormSubmit: SubmitHandler<FormFields> = React.useCallback(async(formData) => {
try { try {
await recaptcha.fetchProtectedResource(authFetchFactory(formData.email)); // await recaptcha.fetchProtectedResource(authFetchFactory(formData.email));
const token = await recaptcha.executeAsync();
if (!token) {
throw new Error('ReCaptcha is not solved');
}
await recaptcha.fetchProtectedResource(authFetchFactory(formData.email), token);
mixpanel.logEvent(mixpanel.EventTypes.ACCOUNT_LINK_INFO, { mixpanel.logEvent(mixpanel.EventTypes.ACCOUNT_LINK_INFO, {
Source: 'Profile', Source: 'Profile',
Status: 'OTP sent', Status: 'OTP sent',
......
...@@ -51,7 +51,13 @@ const AuthModalScreenEmail = ({ onSubmit, isAuth, mixpanelConfig }: Props) => { ...@@ -51,7 +51,13 @@ const AuthModalScreenEmail = ({ onSubmit, isAuth, mixpanelConfig }: Props) => {
const onFormSubmit: SubmitHandler<EmailFormFields> = React.useCallback(async(formData) => { const onFormSubmit: SubmitHandler<EmailFormFields> = React.useCallback(async(formData) => {
try { try {
await recaptcha.fetchProtectedResource(sendCodeFetchFactory(formData.email)); // await recaptcha.fetchProtectedResource(sendCodeFetchFactory(formData.email));
// Ensure initial token is present for endpoints that always require reCAPTCHA
const token = await recaptcha.executeAsync();
if (!token) {
throw new Error('ReCaptcha is not solved');
}
await recaptcha.fetchProtectedResource(sendCodeFetchFactory(formData.email), token);
if (isAuth) { if (isAuth) {
mixpanelConfig?.account_link_info.source !== 'Profile' && mixpanel.logEvent(mixpanel.EventTypes.ACCOUNT_LINK_INFO, { mixpanelConfig?.account_link_info.source !== 'Profile' && mixpanel.logEvent(mixpanel.EventTypes.ACCOUNT_LINK_INFO, {
......
...@@ -84,7 +84,12 @@ const AuthModalScreenOtpCode = ({ email, onSuccess, isAuth }: Props) => { ...@@ -84,7 +84,12 @@ const AuthModalScreenOtpCode = ({ email, onSuccess, isAuth }: Props) => {
try { try {
formApi.clearErrors('code'); formApi.clearErrors('code');
setIsCodeSending(true); setIsCodeSending(true);
await recaptcha.fetchProtectedResource(resendCodeFetchFactory); // await recaptcha.fetchProtectedResource(resendCodeFetchFactory);
const token = await recaptcha.executeAsync();
if (!token) {
throw new Error('ReCaptcha is not solved');
}
await recaptcha.fetchProtectedResource(resendCodeFetchFactory, token);
toaster.success({ toaster.success({
title: 'Success', title: 'Success',
......
...@@ -60,7 +60,12 @@ const TokenInstanceMetadataFetcher = ({ hash, id }: Props) => { ...@@ -60,7 +60,12 @@ const TokenInstanceMetadataFetcher = ({ hash, id }: Props) => {
const initializeUpdate = React.useCallback(async() => { const initializeUpdate = React.useCallback(async() => {
try { try {
await recaptcha.fetchProtectedResource(apiFetchFactory); // await recaptcha.fetchProtectedResource(apiFetchFactory);
const token = await recaptcha.executeAsync();
if (!token) {
throw new Error('ReCaptcha is not solved');
}
await recaptcha.fetchProtectedResource(apiFetchFactory, token);
setStatus?.('WAITING_FOR_RESPONSE'); setStatus?.('WAITING_FOR_RESPONSE');
toaster.loading({ toaster.loading({
id: TOAST_ID, id: TOAST_ID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment