|
@@ -21,12 +21,13 @@
|
|
|
--%>
|
|
|
|
|
|
<%@ page import="password.pwm.http.JspUtility" %>
|
|
|
-<%@ page import="password.pwm.http.PwmRequest" %>
|
|
|
+<%@ page import="password.pwm.http.PwmRequestAttribute" %>
|
|
|
<%@ page import="password.pwm.http.tag.value.PwmValue" %>
|
|
|
<%@ page import="password.pwm.util.CaptchaUtility" %>
|
|
|
-<%@ page import="password.pwm.http.PwmRequestAttribute" %>
|
|
|
<%@ taglib uri="pwm" prefix="pwm" %>
|
|
|
-<% if (CaptchaUtility.captchaEnabledForRequest(JspUtility.getPwmRequest(pageContext))) { %>
|
|
|
+<% final CaptchaUtility.CaptchaMode captchaMode = CaptchaUtility.readCaptchaMode( JspUtility.getPwmRequest( pageContext ) ); %>
|
|
|
+<% final boolean captchaEnabled = CaptchaUtility.captchaEnabledForRequest( JspUtility.getPwmRequest(pageContext) ); %>
|
|
|
+<% if (captchaEnabled ) { %>
|
|
|
<% CaptchaUtility.prepareCaptchaDisplay(JspUtility.getPwmRequest(pageContext)); %>
|
|
|
<div id="recaptcha-container">
|
|
|
</div>
|
|
@@ -34,6 +35,7 @@
|
|
|
<span><pwm:display key="Display_JavascriptRequired"/></span>
|
|
|
<a href="<pwm:context/>"><pwm:display key="Title_MainPage"/></a>
|
|
|
</noscript>
|
|
|
+<% if ( captchaMode == CaptchaUtility.CaptchaMode.V3 ) { %>
|
|
|
<%-- begin reCaptcha section (http://code.google.com/apis/recaptcha/docs/display.html) --%>
|
|
|
<pwm:script>
|
|
|
<script type="text/javascript">
|
|
@@ -49,3 +51,43 @@
|
|
|
</pwm:script>
|
|
|
<script nonce="<pwm:value name="<%=PwmValue.cspNonce%>"/>" src="<%=(String)JspUtility.getAttribute(pageContext,PwmRequestAttribute.CaptchaClientUrl)%>?onload=onloadCallback&render=explicit" defer async></script>
|
|
|
<% } %>
|
|
|
+<% if ( captchaMode == CaptchaUtility.CaptchaMode.V3_INVISIBLE ) { %>
|
|
|
+<!-- captcha v3-invisible 1.0 -->
|
|
|
+<input type="hidden" name="g-recaptcha-response" id="g-recaptcha-response"/>
|
|
|
+<pwm:script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ PWM_GLOBAL['startupFunctions'].push(function() {
|
|
|
+ PWM_MAIN.doQuery('.pwm-form-captcha',function(formElement) {
|
|
|
+ PWM_MAIN.addEventHandler(formElement, "submit", function(event){
|
|
|
+ console.log('entering handleCaptchaFormSubmit');
|
|
|
+
|
|
|
+ PWM_VAR['captcha-form-element'] = formElement;
|
|
|
+ PWM_MAIN.cancelEvent(event);
|
|
|
+
|
|
|
+ grecaptcha.execute();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ var onloadCaptcha = function() {
|
|
|
+ console.log('entering onloadCaptcha');
|
|
|
+ };
|
|
|
+
|
|
|
+ var postCaptchaFormSubmit = function(response) {
|
|
|
+ console.log('entering postCaptchaFormSubmit, response=' + response);
|
|
|
+ var form = PWM_VAR['captcha-form-element'];
|
|
|
+ PWM_MAIN.getObject('g-recaptcha-response').value = response;
|
|
|
+ PWM_MAIN.handleFormSubmit(form);
|
|
|
+ };
|
|
|
+ </script>
|
|
|
+</pwm:script>
|
|
|
+<div class="g-recaptcha"
|
|
|
+ data-sitekey="<%=JspUtility.getAttribute(pageContext,PwmRequestAttribute.CaptchaPublicKey)%>"
|
|
|
+ data-callback="postCaptchaFormSubmit"
|
|
|
+ data-size="invisible">
|
|
|
+</div>
|
|
|
+<script nonce="<pwm:value name="<%=PwmValue.cspNonce%>"/>" src="<%=(String)JspUtility.getAttribute(pageContext,PwmRequestAttribute.CaptchaClientUrl)%>?onload=onloadCaptcha" async defer></script>
|
|
|
+<% } %>
|
|
|
+<% } %>
|