keycloak / keycloak

Open Source Identity and Access Management For Modern Applications and Services
https://www.keycloak.org
Apache License 2.0
23.41k stars 6.77k forks source link

Username Form should support autocomplete #34091

Closed xsrf closed 3 weeks ago

xsrf commented 3 weeks ago

Description

The Username Form in the base theme prevents autocomplete, e.g. by some password managers, by setting autocomplete="off" at https://github.com/keycloak/keycloak/blob/7bdd10d77d5027270aa282732839db7d25686118/themes/src/main/resources/theme/base/login/login-username.ftl#L20 I can't come up with a reason for this.

Discussion

No response

Motivation

I want my browser to suggest my username for the login form and not having to type it manually every time.

Details

Set autocomplete="username" instead.

Can reproduce the issue with Chromes (v129, Windows) built in password manager. It suggests username and password on the "Username Password Form" but not on the "Username Form". If I change the autocomplete to username via content overrides in chromes dev-tools in the browser, I also get the suggestion on "Username Form".

codespearhead commented 3 weeks ago

There doesn’t appear to be any blockers for this change [1][2][3], aside from what’s documented here [4][5]. It may have been included accidentally during the copy-paste process while crafting the page [6].

Do you have the bandwidth to create a PR [7]? There might be other cases where disabling autocomplete should be changed [8].


[1] https://github.com/keycloak/keycloak/blame/eedd167e701e990253431b7e3b687f93fa5ee6a9/themes/src/main/resources/theme/base/login/login-username.ftl#L20 [2] https://github.com/keycloak/keycloak/commit/a8df7d88a1c9a223ec4a5f07999986d8a352b2be [3] https://github.com/keycloak/keycloak/pull/7470 [4] https://www.patternfly.org/components/forms/form-control/ [5] https://github.com/patternfly/patternfly/blob/b93029abee9117da890c05f219412e3c423d57b4/src/patternfly/components/FormControl/examples/FormControl.md?plain=1#L11 [6] https://github.com/keycloak/keycloak/commit/4214793a2da0cda516332a1f253d644c6dd70fe5 [7] https://github.com/keycloak/keycloak/blob/main/CONTRIBUTING.md#contributing-to-keycloak [8] https://github.com/search?q=repo%3Akeycloak%2Fkeycloak+autocomplete%3D%22off%22&type=code

jonkoops commented 3 weeks ago

This seems like a good enhancement, I would welcome a PR.