问题
Modern browsers save passwords. Which criteria affect this decision?
Background:
I have a registration page with the following form:
<form action="/BlaBla/Account/Register" method="post">
<div>
<fieldset>
<legend>Account Information</legend>
<p>
<label for="username">
Username:</label>
<input id="username" name="username" type="text" value="" />
</p>
<p>
<label for="email">
Email:</label>
<input id="email" name="email" type="text" value="" />
</p>
<p>
<label for="invitationCode">
Invitation Code:</label>
<input id="invitationCode" name="invitationCode" type="text" value="" />
</p>
<p>
<label for="securityQuestion">
Security question:</label>
<input id="securityQuestion" name="securityQuestion" type="text" value="" />
</p>
<p>
<label for="securityAnswer">
Security answer:</label>
<input id="securityAnswer" name="securityAnswer" type="text" value="" />
</p>
<p>
<label for="password">
Password:</label>
<input id="password" name="password" type="password" />
</p>
<p>
<label for="confirmPassword">
Confirm password:</label>
<input id="confirmPassword" name="confirmPassword" type="password" />
</p>
<p class="buttons">
<input type="submit" value="Register" />
</p>
</fieldset>
</div>
</form>
Mozilla seems to think that the fields securityAnswer
and password
are the user/pw fields, with awkward consequences (security answer stored as username is bad).
回答1:
I'd guess it assumes the field above 'password' is the username. You could try re-ordering them.
回答2:
Also, Internet Explorer's "remember password" feature doesn't remember your passwords if you have more than 2 fields in your form.
回答3:
the input type is set as password, so... (eg <input type="password" name="blah" />
)
来源:https://stackoverflow.com/questions/1523212/how-does-the-the-browser-decide-which-form-fields-are-username-password