p:captcha throws - 在FireFox上阻止加载混合活动内容

时间:2015-01-05 22:07:00

标签: jsf firefox primefaces captcha

我在尝试使用<p:captcha>时遇到问题。我在FireFox v34.0.5中收到以下错误:

Blocked loading mixed active content "http://www.google.com/recaptcha/api/challenge?k=xxxxxxxxxxxxxxxxxxxxxxxxx"

显示复选按钮但不显示验证码图像

我的应用程序托管在安全(HTTPS)服务器中,但似乎验证码使用HTTP连接到非安全服务器

这是我的web.xml文件:

<context-param>
    <param-name>primefaces.PUBLIC_CAPTCHA_KEY</param-name>
    <param-value><xxxxx_recaptcha_generated_public_captcha_key></param-value>
</context-param>
<context-param>
    <param-name>primefaces.PRIVATE_CAPTCHA_KEY</param-name>
    <param-value><xxxxx_recaptcha_generated_private_captcha_key></param-value>
</context-param>

我的视图文件(forgottenOPassword.xhtml):

<p:captcha label="Captcha" rendered="#{passBB.showCaptcha}"/>

<p:commandButton actionListener="#{passBB.verifyCaptcha}"
                 ajax="false" 
                 icon="ui-icon-check"
                 rendered="#{passBB.showCaptcha}"
                 value="Check"/>

1 个答案:

答案 0 :(得分:2)

secure的{​​{1}}属性设置为<p:captcha>。另请参阅VDL documentation&#34;启用https支持&#34;

true

或者,如果您想让它依赖于当前请求(例如,当您将2个版本的webapp和验证码放在某个可重复使用的标记文件/组件中时),请检查{{3而是:

<p:captcha ... secure="true" />

无论哪种方式,如果评估为<p:captcha ... secure="#{request.secure}" /> ,则为HttpServletRequest#isSecure()