简体   繁体   English

Firefox 记住错误的详细信息用户名

[英]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. Firefox 提供记住您的详细信息,但将出生日期字段(密码字段前的最后一个文本框)作为用户名。 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?有谁知道我如何告诉 Firefox 电子邮件地址字段是密码的标识符?

I know I can use autocomplete="off", but we still want the user to remember their password, just with the correct values.我知道我可以使用 autocomplete="off",但我们仍然希望用户记住他们的密码,只是使用正确的值。

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. Firefox 将password字段之前的字段作为您的username ,而不管nameidautocomplete属性如何。

The solution解决方案

Place your username field and password field next to each other.您的username段和password字段放在一起。


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).注意:关闭autocomplete告诉 Firefox 忘记表单数据,但如果这是一个注册表单,Firefox 仍会询问用户是否应保存凭据(与常规表单数据分开存储)。

I've witnessed this behavior in Chrome as well (and customers have reported it in IE), so it's not just a Firefox issue.我也在 Chrome 中目睹了这种行为(并且客户已经在 IE 中报告了它),所以这不仅仅是 Firefox 问题。 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.即,正如Nelu所说,出现密码字段之前的文本字段(即name="password"的字段)被视为登录名字段,而不管其名称等。如果有其他表单字段不是“文本”,它们将被忽略。

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.好吧,现在我正在盲目射击,但有一个猜测:Firefox 可能不会保存隐藏输入的表单值,而是寻找替代品。

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.试试这个:在第二阶段,将名称输入作为文本输入类型,而不是隐藏输入类型,而是用 css 隐藏它。 Then things might work better.那么事情可能会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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