diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/components/registration/LoginForm.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modern/src/components/registration/LoginForm.js b/modern/src/components/registration/LoginForm.js index 8775a98..bbb5d5f 100644 --- a/modern/src/components/registration/LoginForm.js +++ b/modern/src/components/registration/LoginForm.js @@ -8,6 +8,7 @@ import { useHistory } from 'react-router-dom'; import { sessionActions } from '../../store'; import { useLocalization, useTranslation } from '../../LocalizationProvider'; import StartPage from '../../StartPage'; +import usePersistedState from '../../common/usePersistedState'; const useStyles = makeStyles((theme) => ({ logoContainer: { @@ -30,8 +31,10 @@ const LoginForm = () => { const languageList = Object.entries(languages).map((values) => ({ code: values[0], name: values[1].name })); const [failed, setFailed] = useState(false); - const [email, setEmail] = useState(''); + + const [email, setEmail] = usePersistedState('loginEmail', ''); const [password, setPassword] = useState(''); + const registrationEnabled = useSelector((state) => (state.session.server ? state.session.server.registration : false)); const emailEnabled = useSelector((state) => (state.session.server ? state.session.server.emailEnabled : false)); @@ -77,7 +80,7 @@ const LoginForm = () => { name="email" value={email} autoComplete="email" - autoFocus + autoFocus={!email} onChange={(e) => setEmail(e.target.value)} onKeyUp={handleSpecialKey} helperText={failed && 'Invalid username or password'} @@ -94,6 +97,7 @@ const LoginForm = () => { value={password} type="password" autoComplete="current-password" + autoFocus={!!email} onChange={(e) => setPassword(e.target.value)} onKeyUp={handleSpecialKey} variant="filled" |