firefox fills in the password into the username field

不羁岁月 提交于 2019-12-04 09:05:35

Have you by any chance changed the field names, i.e. was the password field called 'loginfield' at one point when the username/password were saved by Firefox? According to Mozilla's wiki the password manager stores the fieldname with the saved login details, so it could be related to that.

Have you tried to remove the username/password from Firefox's password manager and see if it happens again when you try to save the login details again?

The Mozilla Firefox password manager is weird. It has a mind of it's own.

https://wiki.mozilla.org/Firefox%3aPassword_Manager

If you logged into your application using Mozilla, and your login field has id "L" and your password field has id "P", it remembers those ids so it can put the values in for you. This only happens if you have this checked: Options > Security > Remember password checkbox.

Now, if you have a page (or form.. not really sure) with AT LEAST one input field with an id that matches either "L" or "P", the Mozilla Password Manager (built into the browser) will try to use its intelligence to fill in the values for you, even if both fields are not there. See example below for a better picture. This might help you solve your issue.

Let me explain...

I work on forensic software where users have to audit everything they do in every workflow, so it requires their password, so if our clients ever get audited by the FDA, we have a record of the workflow. So we have a password field in our application by every button, but since the user is already logged in, we don't want to have them enter their login also, so that field is suppressed. This is what I had to do to make that methodology work (for Mozilla). I had to add the hidden (display:none) input field.

<input runat="server" type="text" style="display:none;">
<asp:TextBox id="TxtPassword" Runat="server" Width="80" EnableViewState="False" TextMode="Password"></asp:TextBox>

The TextBox control actually renders to an input field in HTML. Before I fixed this issue, I had a search field for a page preceding the password field, and it put the username into that field. If I did not have the hidden input field before an input field with id "P" (or in this case "TxtPassword"), it would still be putting the login into my search field, because it preceded the input field with id "TxtPassword". Having the hidden field (that is hidden) is there to fix this issue in Mozilla. The user name goes into that input box, and notice it doesn't even have an id, yet Mozilla puts the login into that field because of the Mozilla setting shown in the dialog image above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!