diff --git a/apps/extension/src/routes/page/onboarding/import.tsx b/apps/extension/src/routes/page/onboarding/import.tsx index 2cd987086b..42c909829b 100644 --- a/apps/extension/src/routes/page/onboarding/import.tsx +++ b/apps/extension/src/routes/page/onboarding/import.tsx @@ -14,11 +14,17 @@ import { importSelector } from '../../../state/seed-phrase/import'; import { usePageNav } from '../../../utils/navigate'; import { PagePath } from '../paths'; import { ImportForm } from '../../../shared'; +import { FormEvent, MouseEvent } from 'react'; export const ImportSeedPhrase = () => { const navigate = usePageNav(); const { phrase, phraseIsValid } = useStore(importSelector); + const handleSubmit = (event: MouseEvent | FormEvent) => { + event.preventDefault(); + navigate(PagePath.SET_PASSWORD); + }; + return ( navigate(-1)} /> @@ -29,20 +35,22 @@ export const ImportSeedPhrase = () => { Feel free to paste it into the first box and the rest will fill - - - + +
+ + +
diff --git a/apps/extension/src/routes/page/onboarding/set-password.tsx b/apps/extension/src/routes/page/onboarding/set-password.tsx index 10e983fc3f..0058542aff 100644 --- a/apps/extension/src/routes/page/onboarding/set-password.tsx +++ b/apps/extension/src/routes/page/onboarding/set-password.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { FormEvent, MouseEvent, useState } from 'react'; import { BackIcon, Button, @@ -20,6 +20,15 @@ export const SetPassword = () => { const [password, setPassword] = useState(''); const [confirmation, setConfirmation] = useState(''); + const handleSubmit = (event: FormEvent | MouseEvent) => { + event.preventDefault(); + + void (async () => { + await finalOnboardingSave(password); + navigate(PagePath.ONBOARDING_SUCCESS); + })(); + }; + return ( navigate(-1)} /> @@ -31,44 +40,34 @@ export const SetPassword = () => { wallet. - - setPassword(value)} - validations={[ - { - type: 'warn', - issue: 'password too short', - checkFn: (txt: string) => Boolean(txt.length) && txt.length < 8, - }, - ]} - /> - setConfirmation(value)} - validations={[ - { - type: 'warn', - issue: "passwords don't match", - checkFn: (txt: string) => Boolean(txt.length) && password !== txt, - }, - ]} - /> - + +
+ setPassword(value)} + /> + setConfirmation(value)} + validations={[ + { + type: 'warn', + issue: "passwords don't match", + checkFn: (txt: string) => password !== txt, + }, + ]} + /> + +
diff --git a/apps/extension/src/routes/page/restore-password/set-password.tsx b/apps/extension/src/routes/page/restore-password/set-password.tsx index 10e983fc3f..55aae768c6 100644 --- a/apps/extension/src/routes/page/restore-password/set-password.tsx +++ b/apps/extension/src/routes/page/restore-password/set-password.tsx @@ -36,13 +36,6 @@ export const SetPassword = () => { passwordValue={password} label='New password' onChange={({ target: { value } }) => setPassword(value)} - validations={[ - { - type: 'warn', - issue: 'password too short', - checkFn: (txt: string) => Boolean(txt.length) && txt.length < 8, - }, - ]} /> { { type: 'warn', issue: "passwords don't match", - checkFn: (txt: string) => Boolean(txt.length) && password !== txt, + checkFn: (txt: string) => password !== txt, }, ]} /> diff --git a/apps/extension/src/shared/components/password-input.tsx b/apps/extension/src/shared/components/password-input.tsx index c1dd92ad11..a80cf1b95a 100644 --- a/apps/extension/src/shared/components/password-input.tsx +++ b/apps/extension/src/shared/components/password-input.tsx @@ -8,7 +8,7 @@ import { useValidationResult } from '../../hooks/validation-result'; interface PasswordInputProps { passwordValue: string; label: string | ReactElement; - validations: Validation[]; + validations?: Validation[]; onChange: InputProps['onChange']; } diff --git a/apps/extension/src/state/wallets.ts b/apps/extension/src/state/wallets.ts index 95ae5fc8e6..02ed29ba37 100644 --- a/apps/extension/src/state/wallets.ts +++ b/apps/extension/src/state/wallets.ts @@ -30,7 +30,7 @@ export const createWalletsSlice = const fullViewingKey = getFullViewingKey(spendKey); const passwordKey = get().password.key; - if (!passwordKey) throw new Error('Password Key not in storage'); + if (passwordKey === undefined) throw new Error('Password Key not in storage'); const key = await Key.fromJson(passwordKey); const encryptedSeedPhrase = await key.seal(seedPhraseStr);