Call initCaptcha at the right time (#643)

This commit is contained in:
Clément Oudot 2013-11-06 15:56:52 +00:00
parent c31a15660f
commit fb82ce9522
3 changed files with 14 additions and 9 deletions

View File

@ -8,7 +8,7 @@ package Lemonldap::NG::Portal::MailReset;
use strict;
use warnings;
our $VERSION = '1.3.0';
our $VERSION = '1.3.1';
use Lemonldap::NG::Portal::Simple qw(:all);
use base qw(Lemonldap::NG::Portal::SharedConf Exporter);
@ -88,6 +88,11 @@ sub smtpInit {
sub extractMailInfo {
my ($self) = splice @_;
if ( $self->{captcha_mail_enabled} ) {
eval { $self->initCaptcha(); };
$self->lmLog( "Can't init captcha: $@", "error" ) if $@;
}
unless ( $self->param('mail') || $self->param('mail_token') ) {
return PE_MAILFIRSTACCESS if ( $self->request_method =~ /GET/ );
return PE_MAILFORMEMPTY;

View File

@ -69,7 +69,7 @@ use Digest::MD5;
#inherits Apache::Session
#link Lemonldap::NG::Common::Apache::Session::SOAP protected globalStorage
our $VERSION = '1.3.0';
our $VERSION = '1.3.1';
use base qw(Lemonldap::NG::Common::CGI Exporter);
our @ISA;
@ -471,12 +471,6 @@ sub new {
$self->{trustedDomains} =~ s/\./\\./g;
}
# Init the captcha feature if it's enabled
if ( $self->{captcha_login_enabled} || $self->{captcha_mail_enabled} ) {
eval { $self->initCaptcha(); };
$self->lmLog( "Can't init captcha: $@", "error" ) if $@;
}
return $self;
}

View File

@ -8,7 +8,7 @@ package Lemonldap::NG::Portal::_WebForm;
use Lemonldap::NG::Portal::Simple qw(:all);
use strict;
our $VERSION = '1.3.0';
our $VERSION = '1.3.1';
## @apmethod int authInit()
# Does nothing.
@ -23,6 +23,12 @@ sub authInit {
sub extractFormInfo {
my $self = shift;
# Init captcha
if ( $self->{captcha_login_enabled} ) {
eval { $self->initCaptcha(); };
$self->lmLog( "Can't init captcha: $@", "error" ) if $@;
}
# Detect first access and empty forms
my $defUser = defined $self->param('user');
my $defPassword = defined $self->param('password');