不需要的自动填充 [英] Unwanted Autofills
问题描述
我的Web应用程序出现问题.我好像在自动填写我的用户名和密码字段.登录后还可以,问题是即使我将自己的textFields(InputText)命名为其他名称,即使在创建帐户页面中,它仍会自动填充.我在chrome和firefox中都尝试过,但还是一样.
I am having a problem in my web application. I seem to have been experiencing auto-fill in my username and password field. It is ok when I do a log in, the problem is it still does the auto-fill even in the create account page, even though I named my textFields(InputText) different from the other. I have tried this in both chrome and firefox, it still the same.
这是该应用程序和代码的一些屏幕截图.
Here are some screenshots of the application and codes.
对于创建帐户页面
<p:outputLabel id="userLabel" value="Username*" />
<p:inputText id="userField"
value="#{marketingPersonController.marketingPerson.account.username}"
required="true" requiredMessage="Username* value is required."
label="UsernameInput">
<f:ajax
listener="#{marketingPersonController.checkUsernameIfAvailable()}"/>
</p:inputText>
<p:outputLabel id="passLabel" value="Password*"/>
<p:password id="passField"
value="#{marketingPersonController.marketingPerson.account.password}"
feedback="true" inline="true"
match="confirmPassField" required="true"
requiredMessage="Password* value is required" label="PasswordInput"
validatorMessage="Password must be at least 6 characters / Password does not match">
<f:validateLength minimum="6" />
</p:password>
用于我的登录
这是我的登录代码:
<table>
<tr>
<td><p:outputLabel rendered ="#{!accountController.loggedIn}" value ="Username:"/></td>
<td><p:inputText rendered="#{!accountController.loggedIn}" id="username" value="#{accountController.account.username}"/></td>
<td><p:message for="username" rendered ="false"/></td>
</tr>
<tr>
<td><p:outputLabel rendered="#{!accountController.loggedIn}" value="Password:"/></td>
<td><p:password rendered="#{!accountController.loggedIn}" id="password" value="#{accountController.account.password}"/></td>
<td><p:message for="password" rendered ="false"/></td>
</tr>
推荐答案
您需要关闭自动填充功能,但是jsf没有自动填充属性.因此,这意味着您必须基于每个输入将其关闭,或为UIForm编写自定义渲染器.
You need to turn off the autocomplete,but jsf does not have an autocomplete attribute. So that means you have to turn it off on a per-input basis or write a custom renderer for the UIForm.
当前存在一个未解决的问题,要求将此属性添加到:JSF规范问题418.当前计划在JSF 2.2中使用.
There's currently an open issue which requests to add this attribute to the : JSF spec issue 418. Currently, it's scheduled for JSF 2.2.
同时,您可以使用OmniFaces Html5RenderKit获得对组件上的autocomplete ="off"的支持.
In the meanwhile, you can use OmniFaces Html5RenderKit to get support for autocomplete="off" on the component.
这篇关于不需要的自动填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!