Adding Captcha in DSpace document request form

718 views
Skip to first unread message

Olivier Nicole

unread,
Nov 12, 2015, 1:22:35 AM11/12/15
to dspace-c...@googlegroups.com
Hi,

The problem of adding Captcha to DSpace document request form pops from
time to time, but I never saw any public solution. I hope this message
could be one.

In our university, students thesis are kept online and are publicly
available upon request. DSpace fits that policy very well, the thesis
are not anonymously readable and when one wants a copy of the work, the
document request form make it very easy.

Recently, some of my users have been complaining that they are receiving
a high number of document requests and the attached message is obviously
spam. This problem is even more critical for the users in charge of
batch processing the older thesis and who are owner of many documents.

Spam poses two problems: it wastes the time of the receiver on one hand,
but more importantly, a legitimate request for a document may ends being
mistakenly classified as spam and ignored.

One of the proposed solution was to limit the document request to
registered users, but not only it does not fit our policy where
registered users are only the students and no outsiders (in fact,
registration is disabled) but it only pushes the problem one step
further, a viewer would have to register, wait for approval and only
then request the document.

One easy solution is to add an anti-spammer control to the document
request form, that is a Captcha.

With the great help from Leandro (lea8...@gmail.com) I managed to
install the following solution, the installation steps are as follow
(the instructions are for Unix, sorry Windows guys), it works well on my
site with DSpace 4.2 and xmlui:

1) create a reCaptcha account with Google:
https://www.google.com/recaptcha/admin#list once done, you end up with a
Site Key and a Secret Key; you will need these keys in the next step;

2) save the attached file patch-4.2-reCaptcha and edit it: you will find
two placeholders in the file that read "XXX reCaptcha SECRET KEY XXX" and
"XXX reCaptcha SITE KEY XXX"; replace these by the respective keys
from step 1;

3) apply the patch: go to the directory that contains your DSpace source
([dspace-source]/..) and apply he patch with the command;
patch -p <path-name_to_the_patch_file_patch-4.2-reCaptcha

4) save the attached file Span.java into the directory
[dspace-source]/dspace-xmlui/src/main/java/org/dspace/app/xmlui/wing/element

5) go to [dspace-source and run the command:
mvn pakage

6) stop tomcat

7) go to [dspace-source]/dspace/target/dspace-4.2-build/ and run the
command :
ant update

8) restart tomcat


Enjoy,

Olivier

patch-4.2-reCaptcha
Span.java
Reply all
Reply to author
Forward
0 new messages