Project

General

Profile

Revision 8250

use AJAX method of including the captcha. https://projects.ecoinformatics.org/ecoinfo/issues/6098

View differences:

lib/style/common/templates/ldapRegister.tmpl
194 194
                    *Verification Code:
195 195
                </td>
196 196
                <td align="right">
197
                    [% captcha %]
197
                	<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
198
                	<script type="text/javascript">
199
						function showRecaptcha(element) {
200
							Recaptcha.create("[% recaptchaPublicKey %]", element, {
201
							theme: "clean",
202
							callback: Recaptcha.focus_response_field});
203
						}
204
						showRecaptcha("captchaArea");
205
					</script>
206
					<div id="captchaArea"></div>
198 207
                </td>
199 208
            </tr>
200 209
        [% END %]
src/perl/ldapweb.cgi
327 327
    #my $error=null;
328 328
    my $use_ssl= 1;
329 329
    #my $options=null;
330
    $templateVars->{$captcha} = $c->get_html($recaptchaPublicKey,undef, $use_ssl, undef);
330
    # use the AJAX style, only need to provide the public key to the template
331
    $templateVars->{'recaptchaPublicKey'} = $recaptchaPublicKey;
332
    #$templateVars->{$captcha} = $c->get_html($recaptchaPublicKey,undef, $use_ssl, undef);
331 333
    $template->process( $templates->{'header'}, $templateVars );
332 334
    foreach my $tmpl (@{$templateList}) {
333 335
        $template->process( $templates->{$tmpl}, $templateVars );

Also available in: Unified diff