1

On my site, there are two fields on the sign in page: one for email, one for password. If I have already signed up, log out, and go back to sign in, Chrome autofills the username into the email text box instead of the email address.

<div class="inputs">
      <%= devise_error_messages! %>
      <label id="maincontent" class="control-label sr-hidden" for="email">Email Address</label>
      <input id="email-input" name="email" type="email" required='true' autocompletetype='email' autofocus='true' placeholder='Enter your email address...'/>      
      <label class="control-label sr-hidden" for="password">Password</label>
      <%= f.password_field :password, :required => false, :placeholder => "Enter your password...", :id => "password" %>
</div>

In addition, if I delete the password field altogether, no autofill happens at all in the email field and it is left blank. If you click in the field, the drop down autocomplete menu pops up, however.

EDIT[SOLVED]: I switched the name and email fields on the sign up page

chrome assigns a ‘default login credential’ status to whatever field is directly above the password on the sign up page

it recalls that credential automatically for autofill in the field above a password field on the sign in page

it requires one to go to settings>passwords and forms > manage passwords and deleting the erroneous default, and then signing in/up again on the corrected forms

Phil Norfleet
  • 75
  • 1
  • 12
  • what do you want to happen? do you want the email and the username field to autocomplete (correctly)? just the email field with the email address? etc – PhilVarg Sep 29 '15 at 20:22
  • the email field should be prepopulated with the previously supplied email... currently it is being populated with the name, not the email. – Phil Norfleet Sep 29 '15 at 20:24
  • you can try adding `autocomplete=off` to the username field so there wont be a conflict – PhilVarg Sep 29 '15 at 20:25
  • but there is no username field on the sign in page. do you mean add autocomplete=off to the appropriate form on the sign up page? – Phil Norfleet Sep 29 '15 at 20:26
  • its worth a try. chrome is clearly confusing the two fields. some other things would be ensuring the username sign up is properly named (its not accidentally copied with the `name='email'`), and removing `autocompletetype`. i would have expected that to actually solve your problem, but you can try removing it perhaps – PhilVarg Sep 29 '15 at 20:30

3 Answers3

4

Switched the name and email fields on the sign up page, fixed it.

chrome assigns a ‘default login credential’ status to whatever field is directly above the password on the sign up page

it recalls that credential automatically for autofill in the field above a password field on the sign in page

it requires one to go to settings>passwords and forms > manage passwords and deleting the erroneous default, and then signing in/up again on the corrected forms

Phil Norfleet
  • 75
  • 1
  • 12
3

Yeah, this answer also confirms the behavior of autofilling an email or login for a text input directly before a type="password" input. You could also do something like this just before the password input to stop it:

<input name="block-autocomplete" style="opacity: 0.0; width: 1px; height: 1px; position: absolute;" tabindex="-1">

Community
  • 1
  • 1
theblang
  • 9,669
  • 9
  • 61
  • 116
0

You can control what is auto filled by adding a autocomplete attribute to the input tag as explained here: https://developers.google.com/web/fundamentals/design-and-ux/input/forms/#use_metadata_to_enable_auto-complete

For example

<input type="text" autocomplete="name">

Will tell Chrome to auto-enter the name. See the entire list at the link above

adinas
  • 3,453
  • 3
  • 29
  • 39