* closes #181 unlock via enter key * style coherence with semantic fx naming
This commit is contained in:
parent
850620b77b
commit
98599a7d24
|
@ -211,13 +211,22 @@ function LoginForm() {
|
|||
const [stayLoggedIn, setStayLoggedIn] = useState(false);
|
||||
const callAsync = useCallAsync();
|
||||
|
||||
function submit() {
|
||||
const submit = () => {
|
||||
callAsync(loadMnemonicAndSeed(password, stayLoggedIn), {
|
||||
progressMessage: 'Unlocking wallet...',
|
||||
successMessage: 'Wallet unlocked',
|
||||
});
|
||||
}
|
||||
|
||||
const submitOnEnter = (e) => {
|
||||
if (e.code === "Enter" || e.code === "NumpadEnter") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
submit();
|
||||
}
|
||||
}
|
||||
const setPasswordOnChange = (e) => setPassword(e.target.value);
|
||||
const toggleStayLoggedIn = (e) => setStayLoggedIn(e.target.checked);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardContent>
|
||||
|
@ -232,13 +241,14 @@ function LoginForm() {
|
|||
type="password"
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
onChange={setPasswordOnChange}
|
||||
onKeyDown={submitOnEnter}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={stayLoggedIn}
|
||||
onChange={(e) => setStayLoggedIn(e.target.checked)}
|
||||
onChange={toggleStayLoggedIn}
|
||||
/>
|
||||
}
|
||||
label="Keep wallet unlocked"
|
||||
|
|
Loading…
Reference in New Issue