微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

现代浏览器保存密码.哪个标准会影响这个决定?

背景:

我有一个注册页面,其中包含以下表格:

<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似乎认为字段securityAnswer和密码是用户/ pw字段,带来尴尬的后果(安全答案存储为用户名是坏的).

解决方法

我猜它假设“密码”上方的字段是用户名.您可以尝试重新订购它们.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。