Bugzilla – Attachment 28507 Details for
Bug 3144
anti-spam for opac-suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3144 - anti-spam for opac-suggestions
Bug-3144---anti-spam-for-opac-suggestions.patch (text/plain), 2.93 KB, created by
Mason James
on 2014-05-28 02:02:43 UTC
(
hide
)
Description:
Bug 3144 - anti-spam for opac-suggestions
Filename:
MIME Type:
Creator:
Mason James
Created:
2014-05-28 02:02:43 UTC
Size:
2.93 KB
patch
obsolete
>From 6ce403a0f69e46b2dc3aa2b796818bd768875b97 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Wed, 28 May 2014 13:59:20 +1200 >Subject: [PATCH] Bug 3144 - anti-spam for opac-suggestions >Content-Type: text/plain; charset="utf-8" > >this patch adds a negative-captcha feature to the purchase suggestions form > >some info for the curious... > http://nedbatchelder.com/text/stopbots.html > https://github.com/subwindow/negative-captcha > http://www.rubydoc.info/github/subwindow/negative-captcha/frames > >to test this patch... > >1/ apply patch > >2/ enable 'suggestion' and 'AnonSuggestions' sysprefs > >3/ attempt to add a 'purchase suggestion' in OPAC > adding the suggestion should succeed > >4/ edit the koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt file, > to reveal the hidden 'negcap' field > > replace line 87 opac-suggestions.tt, from... > <li id="negcap" style="position: absolute; left: -2000px;"> > to ... > <li id="negcap"> > >5/ attempt to add another suggestion, and populate the 'negcap' field > adding the suggestion should fail >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 6 ++++++ > opac/opac-suggestions.pl | 8 ++++++++ > 2 files changed, 14 insertions(+) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 573cd37..38d9fcc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -82,6 +82,12 @@ > <label for="note">Notes:</label> > <textarea name="note" id="note" rows="5" cols="40"></textarea> > </li> >+ >+ <!-- BZ 3144, add a hidden 'negcap' field --> >+ <li id="negcap" style="position: absolute; left: -2000px;"> >+ negcap <input type="text" name="negcap"/> >+ </li> >+ > </ol> > </fieldset> > <fieldset class="action"> >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 72383eb..fadf1ea 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 $negcaptcha = $input->param('negcap'); >+ >+# BZ 3144 - if a spambot accidentally populates the 'negcap' field in the sugesstions form, then silently skip and return. >+if ($negcaptcha ) { >+ print $input->redirect("/cgi-bin/koha/opac-suggestions.pl"); >+ exit; >+} >+ > delete $$suggestion{$_} foreach qw<op suggestedbyme>; > $op = 'else' unless $op; > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 3144
:
1127
|
28504
|
28505
|
28506
|
28507
|
28508
|
28667
|
28701