From 5ca45d094656bad9375500cad13ce1861d25110c Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 28 May 2014 10:52:09 +1200 Subject: [PATCH] Bug 3144 - anti-spam for opac-suggestions to test this patch... Content-Type: text/plain; charset="utf-8" 1/ 1st, enable 'suggestion' and 'AnonSuggestions' sysprefs 2/ disable javascript in your web-browser 3/ attempt to add a suggestion in OPAC, but leave the 'secret' field empty. - adding the suggestion should succeed http://yourkoha.org/cgi-bin/koha/opac-suggestions.pl 4/ attempt to add another suggestion, and populate 'secret' field - adding the suggestion should fail 5/ enable javascript in your web-browser 6/ attempt to add a suggestion, NOTE: the 'secret' field should now be hidden via javascript - adding the suggestion should succeed --- koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt | 8 ++++++++ opac/opac-suggestions.pl | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt index 5e52d84..b9cb3f6 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt @@ -21,6 +21,10 @@ }[% END %] $(function() { + + // BZ 3144 - dont display 'secret' recaptcha field + $("#secret").remove(); + $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, { "aaSorting": [[ 1, "asc" ]], "aoColumnDefs": [ @@ -124,6 +128,10 @@ [% END %][% END %]
  • + + +
  • +
    Cancel
    diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 72383eb..5c9e348 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -33,6 +33,14 @@ my $input = new CGI; my $allsuggestions = $input->param('showall'); my $op = $input->param('op'); my $suggestion = $input->Vars; +my $recaptcha = $input->param('secret'); + +# BZ 3144 - if a spambot accidentally populates the 'secret' field in the submission form, then silently skip suggestion and return. +if ($recaptcha ) { + print $input->redirect("/cgi-bin/koha/opac-suggestions.pl"); + exit; +} + delete $$suggestion{$_} foreach qw; $op = 'else' unless $op; -- 1.7.10.4