3

How do I get my JSF login page to prompt Chrome to save password?

    <h:form id="login-form" class="form login-form">

                <h:outputLabel for="j_username" value="Email:" />
                <p:inputText value="#{loginBean.j_username}" id="j_username"
                    required="true">
                </p:inputText>

                <h:outputLabel for="j_password" value="Password:" />
                <h:inputSecret value="#{loginBean.j_password}" id="j_password"
                    required="true">

            <p:commandButton id="loginButton"
                value="Login"  action="#{loginBean.login}" />

        </h:form>
DD.
  • 21,498
  • 52
  • 157
  • 246
  • Looks fine to me. Go into settings and tell Chrome you want it to save for that site. – Karl Kildén May 17 '13 at 07:57
  • please try to set autocomplete="off" in inputSecret and username inputText – Laabidi Raissi May 17 '13 at 08:28
  • @Laabidi: Huh? Don't you rather mean "on"? OP want to enable the save of password, not to disable it. Even then, that part is not related to the concrete problem. – BalusC May 17 '13 at 12:05
  • @BalusC ah of course it should be "on". sorry, I lost my attention. And I think not using autocomplete will also affect browser behaviour when submitting the login form. May be the problem is only because of ajax (as you said in your answer) – Laabidi Raissi May 17 '13 at 12:56

1 Answers1

5

Turn off ajax by ajax="false" on the <p:commandButton>. For security reasons, Chrome won't save passwords of ajax login forms.

If that also doesn't help, then go to Settings > Show advanced settings > Manage saved passwords (or go to chrome://settings/passwords in Chrome) and scroll to the very bottom of the list to see if the site in question isn't accidently covered by "Never saved" list.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555