-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move mnemonic passphrase to mnemonic page and add checkbox to show it
disable updater for now add description to dapps
- Loading branch information
minotaur
committed
Feb 26, 2022
1 parent
743d811
commit fe9d3d4
Showing
18 changed files
with
246 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { Checkbox, Container, FormControlLabel, Grid } from "@material-ui/core"; | ||
import PasswordInput from "../../../components/PasswordInput"; | ||
|
||
interface PropsType { | ||
password: string; | ||
valid: boolean; | ||
confirm?: boolean; | ||
goBack?: () => any; | ||
setPassword: (password: string, valid: boolean) => any; | ||
} | ||
|
||
const MnemonicPassword = (props: PropsType) => { | ||
const [usePassword, setUsePassword] = useState(!!props.password); | ||
const [password, setPassword] = useState(props.password ? props.password : ""); | ||
const [passwordConfirm, setPasswordConfirm] = useState(props.password ? props.password : ""); | ||
|
||
const validatePasswordConfirm = () => { | ||
if (!props.confirm || !usePassword) return ""; | ||
return (passwordConfirm !== password) ? "Passwords are not same" : ""; | ||
}; | ||
useEffect(() => { | ||
const valid = validatePasswordConfirm() === ''; | ||
const aggregated_password = usePassword ? password : "" | ||
if(props.password !== aggregated_password || valid !== props.valid){ | ||
props.setPassword(aggregated_password, valid) | ||
} | ||
}) | ||
return ( | ||
<Grid container spacing={2}> | ||
<Grid item xs={12}> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={usePassword} | ||
onChange={event => setUsePassword(event.target.checked)} | ||
name="use Password" | ||
color="primary" | ||
/> | ||
} | ||
label="Extend Mnemonic using extra password" | ||
/> | ||
</Grid> | ||
{usePassword ? ( | ||
<React.Fragment> | ||
<PasswordInput | ||
label="Mnemonic passphrase" | ||
error={""} | ||
password={password} | ||
setPassword={setPassword} /> | ||
{ | ||
props.confirm ? ( | ||
<PasswordInput | ||
error={validatePasswordConfirm()} | ||
password={passwordConfirm} | ||
setPassword={setPasswordConfirm} | ||
label="Confirm Mnemonic passphrase" /> | ||
) : null | ||
} | ||
</React.Fragment> | ||
) : null} | ||
</Grid> | ||
); | ||
|
||
}; | ||
|
||
|
||
export default MnemonicPassword; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.