Fix non editable username

This commit is contained in:
Joseph Garrone
2021-03-05 00:03:21 +01:00
parent 533105d63a
commit 0cfe240590
2 changed files with 23 additions and 9 deletions

View File

@ -44,6 +44,12 @@ export const Login = memo((props: LoginProps) => {
(setIsLoginButtonDisabled(true), true)
);
const [ usernameInputValue, setUsernameInputValue ] = useState(login.username ?? '');
const onUsernameChange = useConstCallback(
(event: React.ChangeEvent<HTMLInputElement>)=>
setUsernameInputValue(event.target.value)
);
return (
<Template
@ -82,9 +88,10 @@ export const Login = memo((props: LoginProps) => {
id="username"
className={cx(kcProperties.kcInputClass)}
name="username"
value={login.username ?? ''}
value={usernameInputValue}
type="text"
{...(usernameEditDisabled ? { "disabled": true } : { "autofocus": true, "autocomplete": "off" })}
onChange={onUsernameChange}
{...(usernameEditDisabled ? { "disabled": true } : { "autoFocus": true, "autocomplete": "off" })}
/>
</div>
<div className={cx(kcProperties.kcFormGroupClass)}>