diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-28 08:15:56 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-28 08:15:56 +0000 |
commit | 6220db47b3e23c8d14cbecbdda34be83d47889ae (patch) | |
tree | 85f76e622fb90c1dd7de187af8dce2858333cc42 /modules/recaptcha/views | |
parent | 66fae635580890a2c25820b76f680baad11669af (diff) |
Simplify the recaptcha admin page. It's not guaranteed to verify your
recaptcha private key properly anymore, but it's more intuitive to
configure in the admin UI.
Diffstat (limited to 'modules/recaptcha/views')
-rw-r--r-- | modules/recaptcha/views/admin_recaptcha.html.php | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/modules/recaptcha/views/admin_recaptcha.html.php b/modules/recaptcha/views/admin_recaptcha.html.php index e4f00e00..ed90aea9 100644 --- a/modules/recaptcha/views/admin_recaptcha.html.php +++ b/modules/recaptcha/views/admin_recaptcha.html.php @@ -1,52 +1,30 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> -<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> -<script> -var RecaptchaOptions = {lang: 'en', theme: "white"}; - -$("#gConfigureRecaptchaForm").ready(function() { - $("#gConfigureRecaptchaForm :submit").before("<ul><li id=recaptcha_div /></ul>"); - $("#public_key").change(function() { - showRecaptcha($(this).val()); - }); - var original = $("#public_key").val(); - if (original != "") { - showRecaptcha(original); - } -}); - -function showRecaptcha(public_key) { - if (public_key != "") { - Recaptcha.widget = document.getElementById("recaptcha_div"); - $.ajax({url: "<?= url::site("admin/recaptcha/gethtml") ?>/" + public_key <? if (!empty($form->captcha_error)): ?> + "/<?= $form->captcha_error ?>" <? endif ?> , - dataType: "json", - cache: false, - error: function(request, textStatus, errorThrown) { - var public_key = $("#gConfigureRecaptchaForm ul li:first-child"); - public_key.addClass("gError"); - $("#gConfigureRecaptchaForm ul li:first-child p").replaceWith(""); - public_key.append('<p class="gError">' + request.responseText + "</p>"); - }, - success: function(data, textStatus) { - var public_key = $("#gConfigureRecaptchaForm ul li:first-child"); - public_key.removeClass("gError"); - $("#gConfigureRecaptchaForm ul li:first-child p").replaceWith(""); - $("#recaptcha_div").html("<script type='text/javascript'>" + data.script + "</script" + ">"); - } - }); - } else { - if (Recaptcha.widget != undefined) { - Recaptcha.destroy(); - } - } -} - -</script> - <div id="gAdminRecaptcha"> <h1> <?= t("ReCaptcha Challenge Filtering") ?> </h1> <p> - <?= t("Recaptcha is a free CAPTCHA service that helps to digitize books, newspapers and old time radio shows. automated spam filtering service. In order to use it, you need to sign up for a <a href=\"{$form->get_key_url}\">ReCaptcha Public/Private Key pair</a>, which is also free. Once registered, the the challenge and response strings are evaluated at <a href=\"http://recaptcha.net\">recaptcha.net</a> to determine if the form content has been entered by a bot.") ?> + <?= t("Recaptcha is a free CAPTCHA service that helps to digitize books, newspapers and old time radio shows. automated spam filtering service. In order to use it, you need to sign up for a <a href=\"{$form->get_key_url}\">ReCaptcha Public/Private Key pair</a>, which is also free. Once registered, the the challenge and response strings are evaluated at <a href=\"%url\">recaptcha.net</a> to determine if the form content has been entered by a bot.", array("url" => "http://recaptcha.net")) ?> </p> <?= $form ?> </div> + +<? if ($public_key && $private_key): ?> +<div id="gAdminRecaptchaTest" class="gBlock"> + <h2> <?= t("Recaptcha Test") ?> </h2> + <p> + <?= t("If you see a captcha form below, then Recaptcha is functioning properly.") ?> + </p> + + <div id="gRecaptcha"/> + <script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script> + <script type="text/javascript"> + Recaptcha.create("<?= $public_key ?>", "gRecaptcha", { + callback: Recaptcha.focus_response_field, + lang: "en", + theme: "white" + }); + </script> + </div> +</div> +<? endif ?> + |