Fix SSL/Kerberos Auth with Choice (#1636)

This commit is contained in:
Christophe Maudoux 2019-02-03 00:17:53 +01:00
parent a084ba3c84
commit 3021e998a7
3 changed files with 13 additions and 8 deletions

View File

@ -2,7 +2,7 @@ package Lemonldap::NG::Portal::Auth::Choice;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS);
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS PE_ERROR);
our $VERSION = '2.0.2';
@ -25,17 +25,21 @@ sub _authCancel {
sub extractFormInfo {
my ( $self, $req ) = @_;
unless ( $self->checkChoice($req) ) {
$self->logger->debug("Searching for Auth module AJAX init/script...");
$self->logger->debug("Initializing Auth modules...");
foreach my $mod ( values %{ $self->modules } ) {
if ( $mod->{AjaxInitScript} and $mod->{Name} ) {
if ( $mod->{AjaxInitScript} ) {
$self->logger->debug(
'Append ' . $mod->Name . ' init/script' );
'Append ' . $mod->{Name} . ' init/script' ) if $mod->{Name};
$req->data->{customScript} .= $mod->AjaxInitScript;
}
if ( $mod->{InitCmd} ) {
eval( $mod->{InitCmd} );
die 'Unable to launch init commmand ' . $mod->{InitCmd}
if ($@);
$self->logger->debug(
'Launch ' . $mod->{Name} . ' init command' ) if $mod->{Name};
my $res = eval( $mod->{InitCmd} );
if ($@) {
$self->logger("Auth error: $@");
return PE_ERROR;
}
}
}
foreach my $mod ( values %{ $self->modules } ) {

View File

@ -460,6 +460,7 @@ sub buildHiddenForm {
if $self->checkXSSAttack( $_, $req->{portalHiddenFormValues}->{$_} );
# Build hidden input HTML code
#$val .= qq{<input type="hidden" name="$_" id="$_" value="}
$val .= qq{<input type="hidden" name="$_" id="$_" value="}
. $req->{portalHiddenFormValues}->{$_} . '" />';
}

View File

@ -607,7 +607,7 @@ sub autoPost {
# Add element into $self->{portalHiddenFormValues}, those values could be
# used to hide values into HTML form.
# @param fieldname The field name which will contain the correponding value
# @param fieldname The field name which will contain the corresponding value
# @param value The associated value
# @param prefix Prefix of the field key
# @param base64 Encode value in base64