lemonldap-ng/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Captcha.pm

41 lines
852 B
Perl
Raw Normal View History

2017-01-24 18:55:20 +01:00
package Lemonldap::NG::Portal::Lib::Captcha;
# Old Captcha API, this is only a wrapper around Captcha::SecurityImage
2017-01-24 18:55:20 +01:00
use strict;
use Mouse;
use MIME::Base64;
2022-07-28 12:42:15 +02:00
our $VERSION = '2.0.15';
2017-01-24 18:55:20 +01:00
extends 'Lemonldap::NG::Common::Module';
has module => (
is => 'rw',
handles => [
qw(setCaptcha validateCaptcha getCaptcha ott width height lines scramble fgColor bgColor rndmax timeout )
]
2017-01-24 22:02:02 +01:00
);
2017-01-24 18:55:20 +01:00
2021-04-01 23:07:58 +02:00
sub init {
2017-01-24 18:55:20 +01:00
my ($self) = @_;
2017-01-24 22:02:02 +01:00
if ( $self->conf->{captcha} ) {
$self->logger->error( "The Lib::Captcha API is not compatible"
. " with custom Captcha module" );
2017-01-24 22:02:02 +01:00
return 0;
}
else {
my $module = $self->p->loadModule("::Captcha::SecurityImage");
if ($module) {
$self->module($module);
return 1;
}
else {
return 0;
}
2017-01-24 22:02:02 +01:00
}
2017-01-26 22:42:42 +01:00
}
2017-01-24 18:55:20 +01:00
1;