add comments on initCaptcha method
This commit is contained in:
parent
cce1a6365a
commit
6702a5068c
|
@ -766,22 +766,31 @@ sub buildHiddenForm {
|
|||
# @return nothing
|
||||
sub initCaptcha {
|
||||
my $self = shift;
|
||||
|
||||
# Store captcha data
|
||||
opendir( OUTPUT, $self->{captcha_output} )
|
||||
or $self->lmLog( "Can't open captcha output dir", "error" );
|
||||
opendir( DATA, $self->{captcha_data} )
|
||||
or $self->lmLog( "Can't open captcha data dir", "error" );
|
||||
|
||||
# Clean previous captcha datas
|
||||
foreach ( readdir(OUTPUT) ) {
|
||||
next if ( $_ eq ".." or $_ eq "." );
|
||||
system("rm -f $_ &>/dev/null")
|
||||
or $self->lmLog( "Can't clean captcha output dir!", "warn" );
|
||||
}
|
||||
|
||||
# Build Authen::Captcha object
|
||||
$self->{captcha} = Authen::Captcha->new(
|
||||
data_folder => $self->{captcha_data},
|
||||
output_folder => $self->{captcha_output}
|
||||
);
|
||||
|
||||
# Generate a new captcha from captcha object
|
||||
$self->{captcha_code} =
|
||||
$self->{captcha}->generate_code( $self->{captcha_size} );
|
||||
$self->{captcha_img} = "/captcha_output/" . $self->{captcha_code} . ".png";
|
||||
|
||||
closedir(DATA) and closedir(OUTPUT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user