diff --git a/ts/components/dialog/SessionSeedModal.tsx b/ts/components/dialog/SessionSeedModal.tsx index ba6eba3a0..c2927301c 100644 --- a/ts/components/dialog/SessionSeedModal.tsx +++ b/ts/components/dialog/SessionSeedModal.tsx @@ -188,7 +188,6 @@ interface ModalInnerProps { const SessionSeedModalInner = (props: ModalInnerProps) => { const { onClickOk } = props; - const [loadingPassword, setLoadingPassword] = useState(true); const [loadingSeed, setLoadingSeed] = useState(true); const [recoveryPhrase, setRecoveryPhrase] = useState(''); const [hasPassword, setHasPassword] = useState(null); @@ -197,30 +196,22 @@ const SessionSeedModalInner = (props: ModalInnerProps) => { const dispatch = useDispatch(); useMount(() => { - async function checkHasPassword() { - if (!loadingPassword) { + async function validateAccess() { + if (passwordHash || recoveryPhrase) { return; } const hash = await Data.getPasswordHash(); setHasPassword(!!hash); setPasswordHash(hash || ''); - setLoadingPassword(false); - } - async function getRecoveryPhrase() { - if (recoveryPhrase) { - return false; - } + const newRecoveryPhrase = getCurrentRecoveryPhrase(); setRecoveryPhrase(newRecoveryPhrase); setLoadingSeed(false); - - return true; } setTimeout(() => (document.getElementById('seed-input-password') as any)?.focus(), 100); - void checkHasPassword(); - void getRecoveryPhrase(); + void validateAccess(); }); const onClose = () => dispatch(recoveryPhraseModal(null));