I am trying to skip the browser prompt to save the password for my login form.
I have already checked this question, and have added the autocomplete="off" attribute (on both form and fields).
Simply navigating to another page works fine. However when I use ?faces-redirect=true
(in my Home button), I get the prompt.
admin.xhtml:
<h:form id="form" autocomplete="off">
<p:growl id="growl" showDetail="true" sticky="false" life="3000" />
<p:layout fullPage="true">
<p:layoutUnit position="center" >
<p:panel id="loginPanel" visible="#{not admin.loggedIn}">
<h:panelGrid columns="2" cellpadding="5">
<f:facet name="header">
<h:outputLabel value="Administration" />
</f:facet>
<h:outputLabel for="username" value="Username:" />
<p:inputText id="username" value="#{admin.username}" required="true" autocomplete="off" label="username" />
<h:outputLabel for="password" value="Password:" />
<p:password id="password" value="#{admin.password}" required="true" autocomplete="off" label="password" />
<f:facet name="footer">
<p:commandButton value="Login" update="growl loginPanel logoutPanel"
process="loginPanel" actionListener="#{admin.login}" />
</f:facet>
</h:panelGrid>
</p:panel>
</p:layoutUnit>
<p:layoutUnit position="north" size="85">
<p:panel id="logoutPanel">
<p:commandButton value="Home" process="@this"
action="#{menuBean.goHome}" actionListener="#{admin.logout}" />
<p:commandButton rendered="#{admin.loggedIn}"
value="Logout" update="loginPanel logoutPanel"
process="@this" actionListener="#{admin.logout}" />
</p:panel>
</p:layoutUnit>
</p:layout>
</h:form>
MenuBean:
public String goHome() {
String goToPage = "home.xhtml?faces-redirect=true";
return goToPage;
}
Is there any way to deal with this?
Update I am using JSF 2.2.0 and Primaces 5.1. The issue appears on Chrome 42.0, I will test and update for other browsers.
Update 2 Seems to work correctly for IE 8.
I tried the passthrough attributes, (I can see the autocomplete=off
in the generated source) but the behavior is the same.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:p="http://primefaces.org/ui">
<h:form id="form" a:autocomplete="off">
Update 3 I tried disabling caching with the following ways:
Added meta tags to admin.xhtml:
<h:head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>Administration</title>
Added the NoCacheFilter
as indicated by this response.
The HTTP headers are correctly updated:
Still when I am redirected to home.xhtml in Chrome, I get the prompt.