1 Reply Latest reply on Dec 17, 2009 12:26 PM by Sergey Vidyuk

    Captcha is not validated if it has rendered attribute

    Sergey Vidyuk Newbie

      I have requirement to check nonsuccessive login attempts and if it's greater then 3 show captcha on login page for this user. I've added boolean variable to my Authenticator class and added captcha with

      rendered="#{authenticator.captchaRequired}"

      attribute to my login view. It looks like captcha input is not validated at all. I've removed
      rendered="..."

      attribute and everything works correctly. Does anybody know how to handle this situation?


      Here is my login form:


      <h:form id="loginForm">
      
         <rich:panel>
            <f:facet name="header">#{messages['edupro.login.panelTitle']}</f:facet>
      
            <div class="dialog">
               <h:panelGrid columns="3" rowClasses="prop" columnClasses="name,value">
                  <h:outputLabel for="email" value="#{messages['edupro.login.email']}"/>
                  <h:inputText id="email"
                               value="#{credentials.username}"
                               title="#{messages['edupro.login.emailTooltip']}"
                               validator="emailFacesValidator"
                               required="true"/>
                  <h:message for="email" styleClass="message" errorClass="errormsg"
                             infoClass="infomsg" warnClass="warnmsg"/>
                          
                  <h:outputLabel for="password" value="#{messages['edupro.login.password']}"/>
                  <h:inputSecret id="password"
                                 value="#{credentials.password}" 
                                 required="#{!empty param['loginForm:submit']}">
                     <f:validateLength minimum="#{globalSettings.minPasswdLength}"
                                       maximum="#{globalSettings.maxPasswdLength}"/>
                  </h:inputSecret>
                  <h:message for="password" styleClass="message" errorClass="errormsg"
                             infoClass="infomsg" warnClass="warnmsg"/>
                          
                  <h:graphicImage value="/seam/resource/captcha"
                                  rendered="#{authenticator.captchaRequired}"/>
                  <h:inputText id="verifyCaptcha" value="#{captcha.response}"
                               required="true"
                               rendered="#{authenticator.captchaRequired}">
                     <s:validate />
                  </h:inputText>
                  <h:message for="verifyCaptcha" styleClass="message" errorClass="errormsg"
                             infoClass="infomsg" warnClass="warnmsg"
                             rendered="#{authenticator.captchaRequired}"/>
                          
               <h:panelGroup/>
               <h:commandButton id="submit" value="#{messages['edupro.login.submit']}"
                                action="#{authenticator.tryLogin}"/>
               <h:panelGroup/>
                          
               <h:panelGroup/>
               <h:panelGroup/>
               <h:commandLink id="recoverPassword"
                              value="#{messages['edupro.login.forgotPassword']}"
                              title="#{messages['edupro.login.forgotPasswordTooltip']}"
                              action="#{personalServices.recoverPassword}"/>
            </h:panelGrid>
         </div>
      
      </rich:panel>