简体   繁体   中英

Firefox remembers wrong details username

I've seen similar questions but nothing that seems to fix the issue I'm having.

I have a 2 step registration form process. On the first page you enter an email address, on the 2nd step you enter a password (and other details).

Firefox offers to remember your details but takes the date of birth field (the last textbox before the password field) as the username. The email address is in a hidden value on the page.

Does anyone know how I can tell Firefox that the email address field is the identifier for the password?

I know I can use autocomplete="off", but we still want the user to remember their password, just with the correct values.

Many thanks

The problem

Firefox takes the field right before the password field to be your username , regardless of the name , id or autocomplete attributes.

The solution

Place your username field and password field next to each other.


Note: Turning off autocomplete tells Firefox to forget the form data, but if this is a registration form Firefox will still ask the user if the credentials should be saved (stored separately from regular form data).

I've witnessed this behavior in Chrome as well (and customers have reported it in IE), so it's not just a Firefox issue. Namely, as Nelu said, the text field that appears before the password field (that is, a field with name="password") is treated as the login name field, regardless of its name, etc. If there are other form fields that are not "text", they'll be ignored.

For us, the right solution seems to be to avoid giving a field the name of "password" if we don't want that automatic browser behavior to come into play.

I think this is an example of the browser being a wee bit too helpful.

Make sure the name attributes are different for each input.

It may be the case that the browser identifies the first input as username or some equivalent, if no better alternative can be recognised.

EDIT---

Hmm. Well now I'm firing blind, but here's a guess: Firefox might not save form values for hidden inputs, and look for a substitute instead.

Try this: on the second stage, feature the name input as a text input type, not a hidden input type, but hide it with css. Then things might work better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM