浏览器如何确定哪些表单字段是用户名/密码?

问题描述 投票:8回答:3

现代浏览器保存密码。哪些标准会影响此决定?

背景:

我有一个以下格式的注册页面:

    <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似乎认为字段securityAnswerpassword是user / pw字段,结果很尴尬(存储为用户名的安全性答案是错误的。)

forms browser passwords username
3个回答
7
投票

我想它假设'password'上方的字段是用户名。您可以尝试重新订购它们。


3
投票

[此外,如果表单中有两个以上字段,Internet Explorer的“记住密码”功能将不会记住您的密码。


0
投票

输入类型被设置为密码,所以...(例如<input type="password" name="blah" />

© www.soinside.com 2019 - 2024. All rights reserved.