Implement new Captcha API in portal (#2692)
This commit is contained in:
parent
fc626c752a
commit
ef134f8ce1
|
@ -446,6 +446,15 @@ sub display {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display captcha if it's enabled
|
# Display captcha if it's enabled
|
||||||
|
if ( $req->captchaHtml ) {
|
||||||
|
%templateParams =
|
||||||
|
( %templateParams, CAPTCHA_HTML => $req->captchaHtml, );
|
||||||
|
}
|
||||||
|
if ( $req->token ) {
|
||||||
|
%templateParams = ( %templateParams, TOKEN => $req->token, );
|
||||||
|
}
|
||||||
|
|
||||||
|
# DEPRECATED: This is only used for compatibility with existing templates
|
||||||
if ( $req->captcha ) {
|
if ( $req->captcha ) {
|
||||||
%templateParams = (
|
%templateParams = (
|
||||||
%templateParams,
|
%templateParams,
|
||||||
|
@ -453,9 +462,6 @@ sub display {
|
||||||
CAPTCHA_SIZE => $self->{conf}->{captcha_size} || 6
|
CAPTCHA_SIZE => $self->{conf}->{captcha_size} || 6
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( $req->token ) {
|
|
||||||
%templateParams = ( %templateParams, TOKEN => $req->token, );
|
|
||||||
}
|
|
||||||
|
|
||||||
# Show password form if password policy error
|
# Show password form if password policy error
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -30,6 +30,7 @@ has _authentication => ( is => 'rw' );
|
||||||
has _userDB => ( is => 'rw' );
|
has _userDB => ( is => 'rw' );
|
||||||
has _passwordDB => ( is => 'rw' );
|
has _passwordDB => ( is => 'rw' );
|
||||||
has _sfEngine => ( is => 'rw' );
|
has _sfEngine => ( is => 'rw' );
|
||||||
|
has _captcha => ( is => 'rw' );
|
||||||
|
|
||||||
has loadedModules => ( is => 'rw' );
|
has loadedModules => ( is => 'rw' );
|
||||||
|
|
||||||
|
@ -336,6 +337,14 @@ sub reloadConf {
|
||||||
unless $self->{_sfEngine} =
|
unless $self->{_sfEngine} =
|
||||||
$self->loadPlugin( $self->conf->{'sfEngine'} );
|
$self->loadPlugin( $self->conf->{'sfEngine'} );
|
||||||
|
|
||||||
|
# Load Captcha module
|
||||||
|
return $self->fail
|
||||||
|
unless $self->_captcha(
|
||||||
|
$self->loadPlugin(
|
||||||
|
$self->conf->{'captcha'} || '::Captcha::SecurityImage'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
# Compile macros in _macros, groups in _groups
|
# Compile macros in _macros, groups in _groups
|
||||||
foreach my $type (qw(macros groups)) {
|
foreach my $type (qw(macros groups)) {
|
||||||
$self->{"_$type"} = {};
|
$self->{"_$type"} = {};
|
||||||
|
|
|
@ -74,8 +74,10 @@ has lockTime => ( is => 'rw' );
|
||||||
|
|
||||||
# Security
|
# Security
|
||||||
#
|
#
|
||||||
# Captcha
|
# Captcha HTML code to display in forms
|
||||||
has captcha => ( is => 'rw' );
|
has captchaHtml => ( is => 'rw' );
|
||||||
|
# DEPRECATED: 2.0 captcha compatibility
|
||||||
|
has captcha => ( is => 'rw' );
|
||||||
|
|
||||||
# Token
|
# Token
|
||||||
has token => ( is => 'rw' );
|
has token => ( is => 'rw' );
|
||||||
|
|
Loading…
Reference in New Issue