Problem/Motivation
Most password managers are able to fill the login form correctly by guessing what each field means. However, it is a good practice to use autocomplete attributes to explicitly declare what should be filled.
Proposed resolution
We could add autocomplete="username" on the username field and autocomplete="current-password" on the password field both in the user login and the reset password form.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
The default login and password reset forms now include autocomplete attributes, giving better hints to browsers as to what can be automatically filled in where possible. Sites that previously disabled autocomplete will need to check that the technique they use is still compatible with the updated form.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | VSz5FCG - Imgur.png | 26.53 KB | ilgnerfagundes |
| #6 | user-with-autocomplete.png | 33.96 KB | ilgnerfagundes |
| #6 | user-without-autocomplete.png | 28.08 KB | ilgnerfagundes |
| #6 | password-without-autocomplete.png | 27.48 KB | ilgnerfagundes |
Issue fork drupal-3181647
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
cilefen commentedComment #5
tobiasbComment #6
ilgnerfagundes commentedI did the test locally and everything seems to be correct, with the application of the changes the autocomplete appears in the proposed fields. I am leaving images as proof that I did the test locally and that it is really working.
Comment #7
catchThere are contrib modules that explicitly disable autocompete on the login form, so this needs a release note and a change record in case those need to be updated for some reason.
Comment #12
pasqualleAccording to
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site...
it is not possible to disable autocomplete on the login form any more. The same is stated on the No Autocomplete project page.
Comment #13
cilefen commentedShould we close this feature request as effectively impossible to implement?
Comment #14
prudloff commentedThis issue is about using
autocomplete="username"andautocomplete="current-password"and we can still implement this.#12 is answering #7 by saying that most browsers now ignore
autocomplete="off"so we don't need to take this use case into account.Comment #15
cilefen commentedComment #17
prudloff commentedThe password reset form could also probably benefit from
autocomplete="username".Comment #18
ultimikeWe, the mentoring team, are triaging issues for first time contributors at DrupalCon Lille and I think this is a good issue for the contribution day.
We are reserving this issue so please don't work on this issue if you are not at DrupalCon Lille. You can continue the work when the event is over.
I'll be working on this issue today, with first-time contributors.
thanks,
-mike
Comment #19
mullzk commentedWe are in the mentoring-contribution-workshop in DrupalCon Lille, and started to work on this issue.
Currently, we all get an error when starting up DrupalPod:
Manually installing with
ddev composer installworked, but then, drush was missing.Manually installing with
ddev composer require drush/drushworked, but then we get an error when installing the site:Comment #21
ultimikeWe overcame the Composer issue above by realizing that the original MR was over 2 years old and more than 3500 commits behind.
We went ahead and created an update branch and MR. Here's a summary of the steps we took to do so (mainly using the command line):
git rebase 11.xgit push drupal-3181647 3181647-add-autocomplete-attributes --forcegit push drupal-3181647 11.x3181647-add-autocomplete-attributes-11branch on thedrupal-3181647issue fork.The contributors from DrupalCon Lille were: @guzmanb, @maxime.rffd, @hexaki, @samuel_orhan, @rauch, @guiu.rocafort.ferrer, @mullzk, @binnythomas
Comment #23
guiu.rocafort.ferrerComment #24
guiu.rocafort.ferrerUpdated the issue title and description to include the 'user_pass' form.
Updated the 'user_pass' form to add the autocomplete parameter to the name field.
Also written two functional tests to check the 'user_login_form' form and the 'user_pass' form have the autocomplete attributes present in the name and pass fields ( if present ).
Comment #25
binnythomas commentedI reviewed the code in person at DrupalConLille. LTGM
Comment #26
ultimikeComment #27
jurgenhaasI have reviewed the code in MR!5066, tested it successfully locally and since all tests are passing as well, I'm setting this to RTBC.
Comment #28
lostcarpark commentedI have reviewed this change, and all looks in accordance with Drupal coding standards.
I have tested in DrupalPod and verified the
autocompleteattributes are present.I'm happy for this change to be merged.
Comment #34
nod_Committed 981921d and pushed to 11.x. Thanks!
Comment #37
volkswagenchickAdding attribution for the reviewer, James Sheild
Comment #38
bramdriesenAdding the DrupalCon tag as well
Comment #41
longwaveAdded CR and release note snippet.
Comment #42
ronraney commentedAdded a related issue because I think autocomplete should be set to "off" for security reasons, or at least the option to change it somewhere.
https://www.drupal.org/project/drupal/issues/3522461#comment-16094484