Display invalid mnemonic warning

This commit is contained in:
armaniferrante 2021-05-06 13:18:12 -07:00
parent 42d2ea710d
commit a666b172e9
No known key found for this signature in database
GPG Key ID: 58BEF301E91F7828
1 changed files with 8 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import DialogForm from '../components/DialogForm';
export default function LoginPage() { export default function LoginPage() {
const [restore, setRestore] = useState(false); const [restore, setRestore] = useState(false);
const [hasLockedMnemonicAndSeed, loading] = useHasLockedMnemonicAndSeed(); const [hasLockedMnemonicAndSeed, loading] = useHasLockedMnemonicAndSeed();
if (loading) { if (loading) {
return null; return null;
} }
@ -268,7 +268,7 @@ function LoginForm() {
} }
const setPasswordOnChange = (e) => setPassword(e.target.value); const setPasswordOnChange = (e) => setPassword(e.target.value);
const toggleStayLoggedIn = (e) => setStayLoggedIn(e.target.checked); const toggleStayLoggedIn = (e) => setStayLoggedIn(e.target.checked);
return ( return (
<Card> <Card>
<CardContent> <CardContent>
@ -315,7 +315,7 @@ function RestoreWalletForm({ goBack }) {
const mnemonic = normalizeMnemonic(rawMnemonic); const mnemonic = normalizeMnemonic(rawMnemonic);
const isNextBtnEnabled = const isNextBtnEnabled =
password === passwordConfirm && validateMnemonic(mnemonic); password === passwordConfirm && validateMnemonic(mnemonic);
const displayInvalidMnemonic = validateMnemonic(mnemonic) === false && mnemonic.length > 0;
return ( return (
<> <>
{next ? ( {next ? (
@ -340,6 +340,11 @@ function RestoreWalletForm({ goBack }) {
<b>Do not enter your hardware wallet seedphrase here.</b> Hardware <b>Do not enter your hardware wallet seedphrase here.</b> Hardware
wallets can be optionally connected after a web wallet is created. wallets can be optionally connected after a web wallet is created.
</Typography> </Typography>
{displayInvalidMnemonic && (
<Typography fontWeight="fontWeightBold" style={{ color: 'red' }}>
Mnemonic validation failed. Please enter a valid BIP 39 seed phrase.
</Typography>
)}
<TextField <TextField
variant="outlined" variant="outlined"
fullWidth fullWidth