From 925c835a8927f609fd7fd4463f743e319bae3213 Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 5 Jan 2023 23:14:32 -0700 Subject: [PATCH] Onboarding V2: Fix 'Securing my Wallet' when coming from backup reminder after account recovery (#17088) --- .../recovery-phrase/review-recovery-phrase.js | 11 +++++++++-- .../secure-your-wallet/secure-your-wallet.js | 9 +++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/pages/onboarding-flow/recovery-phrase/review-recovery-phrase.js b/ui/pages/onboarding-flow/recovery-phrase/review-recovery-phrase.js index 74673e083..2062fef24 100644 --- a/ui/pages/onboarding-flow/recovery-phrase/review-recovery-phrase.js +++ b/ui/pages/onboarding-flow/recovery-phrase/review-recovery-phrase.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { useHistory } from 'react-router-dom'; +import { useHistory, useLocation } from 'react-router-dom'; import PropTypes from 'prop-types'; import Box from '../../../components/ui/box'; import Button from '../../../components/ui/button'; @@ -23,9 +23,14 @@ import RecoveryPhraseChips from './recovery-phrase-chips'; export default function RecoveryPhrase({ secretRecoveryPhrase }) { const history = useHistory(); const t = useI18nContext(); + const { search } = useLocation(); const [copied, handleCopy] = useCopyToClipboard(); const [phraseRevealed, setPhraseRevealed] = useState(false); const [hiddenPhrase, setHiddenPhrase] = useState(false); + const searchParams = new URLSearchParams(search); + const isFromReminderParam = searchParams.get('isFromReminder') + ? '/?isFromReminder=true' + : ''; return (
@@ -122,7 +127,9 @@ export default function RecoveryPhrase({ secretRecoveryPhrase }) { type="primary" className="recovery-phrase__footer--button" onClick={() => { - history.push(ONBOARDING_CONFIRM_SRP_ROUTE); + history.push( + `${ONBOARDING_CONFIRM_SRP_ROUTE}${isFromReminderParam}`, + ); }} > {t('next')} diff --git a/ui/pages/onboarding-flow/secure-your-wallet/secure-your-wallet.js b/ui/pages/onboarding-flow/secure-your-wallet/secure-your-wallet.js index 49fcd83bb..4ae4f049b 100644 --- a/ui/pages/onboarding-flow/secure-your-wallet/secure-your-wallet.js +++ b/ui/pages/onboarding-flow/secure-your-wallet/secure-your-wallet.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { useHistory } from 'react-router-dom'; +import { useHistory, useLocation } from 'react-router-dom'; import { useSelector } from 'react-redux'; import Box from '../../../components/ui/box'; import Button from '../../../components/ui/button'; @@ -23,12 +23,17 @@ import SkipSRPBackup from './skip-srp-backup-popover'; export default function SecureYourWallet() { const history = useHistory(); const t = useI18nContext(); + const { search } = useLocation(); const currentLocale = useSelector(getCurrentLocale); const [showSkipSRPBackupPopover, setShowSkipSRPBackupPopover] = useState(false); + const searchParams = new URLSearchParams(search); + const isFromReminderParam = searchParams.get('isFromReminder') + ? '/?isFromReminder=true' + : ''; const handleClickRecommended = () => { - history.push(ONBOARDING_REVIEW_SRP_ROUTE); + history.push(`${ONBOARDING_REVIEW_SRP_ROUTE}${isFromReminderParam}`); }; const handleClickNotRecommended = () => {