- Better indentation for _Webform

- Better doc for initCaptcha()
This commit is contained in:
Sandro Cazzaniga 2012-07-25 08:57:53 +00:00
parent d6ab796359
commit 5ade3bf9b2
2 changed files with 26 additions and 23 deletions

View File

@ -466,7 +466,7 @@ sub new {
# init the captcha feature if it's enabled
if ( $self->{captcha_enabled} ) {
eval $self->initCaptcha();
$self->{captcha_initialized} = 1 unless $@ ;
$self->lmLog("Can't init captcha: $@", "error");
}
return $self;
@ -760,8 +760,9 @@ sub buildHiddenForm {
return $val;
}
## @method void initCaptcha()
## @method void initCaptcha(void)
# init captcha module and generate captcha
# @return nothing
sub initCaptcha {
my $self = shift;
opendir(OUTPUT, $self->{captcha_output}) or $self->lmLog("Can't open captcha output dir", "error");
@ -1483,6 +1484,7 @@ sub convertSec {
$day = int($day);
}
# Return the date
return ( $day, $hrs, $min, $sec );
}

View File

@ -57,19 +57,20 @@ sub extractFormInfo {
$self->{captcha_result} = $self->checkCaptcha($captcha_user_code, $self->{captcha_code});
if ( $self->{captcha_result} != 1 ) {
if ( $self->{captcha_result} == -3 or $self->{captcha_result} == -2 ) {
$self->lmLog("Captcha failed: wrong code", "error");
$self->lmLog("Captcha failed: wrong code", 'error');
return PE_CAPTCHAERROR;
}
elsif ( $self->{captcha_result} == 0 ) {
$self->lmLog("Captcha failed: code not checked (file error)", "error");
$self->lmLog("Captcha failed: code not checked (file error)", 'error');
return PE_CAPTCHAERROR;
}
elsif ( $self->{captcha_result} == -1 ) {
$self->lmLog("Captcha failed: code has expired", "error");
$self->lmLog("Captcha failed: code has expired", 'error');
return PE_CAPTCHAERROR;
}
}
}
# Other parameters
$self->{timezone} = $self->param('timezone');
$self->{userControl} ||= '^[\w\.\-@]+$';