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