Skip to content

Commit

Permalink
Item13223: added a placeholder README
Browse files Browse the repository at this point in the history
... so that the packager ships the img subdir where captchas are stored
  • Loading branch information
MichaelDaum committed Jul 17, 2015
1 parent 3c2df3a commit 09cc55e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -3,7 +3,7 @@
*.swp
pub/System/CaptchaPlugin/jquery.captcha.js
pub/System/CaptchaPlugin/jquery.captcha.css
pub/System/CaptchaPlugin/img/
pub/System/CaptchaPlugin/img/*.png
CaptchaPlugin.md5
CaptchaPlugin.sha1
CaptchaPlugin.tgz
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/CaptchaPlugin.pm
@@ -1,7 +1,7 @@
# Visual Confirmation Plugin for Foswiki Collaboration
# Platform, http://Foswiki.org/
#
# Copyright (C) 2011-2014 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2011-2015 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2005-2007 Koen Martens, kmartens@sonologic.nl
# Copyright (C) 2007 KwangErn Liew, kwangern@musmo.com
#
Expand All @@ -27,8 +27,8 @@ use Foswiki::Func ();
use Foswiki::Plugins ();
use Foswiki::OopsException ();

our $VERSION = '2.10';
our $RELEASE = '2.10';
our $VERSION = '2.11';
our $RELEASE = '2.11';
our $SHORTDESCRIPTION = 'A visual challenge-response test to prevent automated scripts from using the wiki';
our $NO_PREFS_IN_TOPIC = 1;
our $core;
Expand Down
13 changes: 10 additions & 3 deletions lib/Foswiki/Plugins/CaptchaPlugin/Captcha.pm
@@ -1,7 +1,7 @@
# Visual Confirmation Plugin for Foswiki Collaboration
# Platform, http://Foswiki.org/
#
# Copyright (C) 2011-2014 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2011-2015 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2005-2007 Koen Martens, kmartens@sonologic.nl
# Copyright (C) 2007 KwangErn Liew, kwangern@musmo.com
#
Expand Down Expand Up @@ -38,7 +38,7 @@ sub new {

my $this = bless({
store => $store,
debug => Foswiki::Func::isTrue($Foswiki::cfg{Plugins}{CaptchaPlugin}{Debug}),
debug => $Foswiki::cfg{Plugins}{CaptchaPlugin}{Debug},
imgDir => $pubDir . "/System/CaptchaPlugin/img",
fontsDir => $pubDir . "/System/CaptchaPlugin/fonts",

Expand Down Expand Up @@ -244,9 +244,13 @@ sub isValid {

my $remoteAddress = Foswiki::Func::getRequestObject()->remoteAddress();

$this->writeDebug("called isValid from $remoteAddress");

# check secret and remote address: the response must come from the same address the challenge was created for
my $isValid = ($this->{secret} eq lc($response) && $remoteAddress eq $this->{remoteAddress})?1:0;

$this->writeDebug("isValid=$isValid");

$this->{counter}--; # tick every check

# log when the captcha was generated via a different remoteAddress
Expand All @@ -270,7 +274,10 @@ sub isValid {
# - the challenge has been checked twice now or
# - we force deletion now

$this->{store}->removeCaptcha($this) if !$isValid || $forceDelete || $this->{counter} <= 0;
if (!$isValid || $forceDelete || $this->{counter} <= 0) {
$this->writeDebug("deleting captcha");
$this->{store}->removeCaptcha($this);
}

return $isValid;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/CaptchaPlugin/Core.pm
@@ -1,7 +1,7 @@
# Visual Confirmation Plugin for Foswiki Collaboration
# Platform, http://Foswiki.org/
#
# Copyright (C) 2011-2014 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2011-2015 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2005-2007 Koen Martens, kmartens@sonologic.nl
# Copyright (C) 2007 KwangErn Liew, kwangern@musmo.com
#
Expand Down Expand Up @@ -34,7 +34,7 @@ sub new {

my $this = bless({
session => $session,
debug => Foswiki::Func::isTrue($Foswiki::cfg{Plugins}{CaptchaPlugin}{Debug}),
debug => $Foswiki::cfg{Plugins}{CaptchaPlugin}{Debug},
saveForAll => $Foswiki::cfg{Plugins}{CaptchaPlugin}{SaveForAll} || 0,
@_
}, $class);
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/CaptchaPlugin/MANIFEST
Expand Up @@ -12,6 +12,7 @@ lib/GD/SecurityImage.pm 0644
lib/GD/SecurityImage/Styles.pm 0644
locale/CaptchaPlugin/de.po 0644
locale/CaptchaPlugin/Foswiki.pot 0644
pub/System/CaptchaPlugin/img/README 0644
pub/System/CaptchaPlugin/CaptchaSnap1.png 0644
pub/System/CaptchaPlugin/fonts/AbscissaBold.ttf 0644
pub/System/CaptchaPlugin/fonts/AcklinRegular.ttf 0644
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/CaptchaPlugin/Store.pm
@@ -1,7 +1,7 @@
# Visual Confirmation Plugin for Foswiki Collaboration
# Platform, http://Foswiki.org/
#
# Copyright (C) 2011-2014 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2011-2015 Michael Daum, http://michaeldaumconsulting.com
# Copyright (C) 2005-2007 Koen Martens, kmartens@sonologic.nl
# Copyright (C) 2007 KwangErn Liew, kwangern@musmo.com
#
Expand Down
1 change: 1 addition & 0 deletions pub/System/CaptchaPlugin/img/README
@@ -0,0 +1 @@
this directory holds auto-generated captcha images

0 comments on commit 09cc55e

Please sign in to comment.