Commit 1da36757 authored by Xavier Guimard's avatar Xavier Guimard

Reinitialize choice when module failed (#1461)

parent ea48c78a
......@@ -22,6 +22,7 @@ our $page_title = 'Lemonldap::NG statistics';
# @return Constant hash used to convert error codes into string.
sub portalTab {
return {
-5 => 'PORTAL_IDPCHOICE',
-4 => 'PORTAL_SENDRESPONSE',
-3 => 'PORTAL_INFO',
-2 => 'PORTAL_REDIRECT',
......
......@@ -23,17 +23,23 @@ sub extractFormInfo {
}
return PE_FIRSTACCESS;
}
return $req->data->{enabledMods0}->[0]->extractFormInfo($req);
my $res = $req->data->{enabledMods0}->[0]->extractFormInfo($req);
delete $req->pdata->{_choice} if ( $res > 0 );
return $res;
}
sub authenticate {
return $_[1]->data->{enabledMods0}->[0]->authenticate( $_[1] );
my $res = $_[1]->data->{enabledMods0}->[0]->authenticate( $_[1] );
delete $_[1]->pdata->{_choice} if ( $res > 0 );
return $res;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$self->checkChoice($req) unless ( $req->data->{enabledMods0} );
return $req->data->{enabledMods0}->[0]->setAuthSessionInfo($req);
my $res = $req->data->{enabledMods0}->[0]->setAuthSessionInfo($req);
delete $_[1]->pdata->{_choice} if ( $res > 0 );
return $res;
}
sub authLogout {
......
......@@ -10,6 +10,7 @@ use constant {
# Portal errors
# Developers warning, do not use PE_INFO, it's reserved to autoRedirect.
PE_IDPCHOICE => -5,
PE_SENDRESPONSE => -4,
PE_INFO => -3,
PE_REDIRECT => -2,
......@@ -90,7 +91,6 @@ use constant {
PE_U2FFAILED => 83,
PE_UNAUTHORIZEDPARTNER => 84,
PE_RENEWSESSION => 85,
PE_IDPCHOICE => 86,
};
# EXPORTER PARAMETERS
......
......@@ -19,16 +19,22 @@ sub init {
sub getUser {
my ( $self, $req, %args ) = @_;
$self->checkChoice($req) or return PE_FIRSTACCESS;
return $req->data->{enabledMods1}->[0]->getUser( $req, %args );
my $res = $req->data->{enabledMods1}->[0]->getUser( $req, %args );
delete $req->pdata->{_choice} if ( $res > 0 );
return $res;
}
sub setSessionInfo {
return $_[1]->data->{enabledMods1}->[0]->setSessionInfo( $_[1] );
my $res = $_[1]->data->{enabledMods1}->[0]->setSessionInfo( $_[1] );
delete $_[1]->pdata->{_choice} if ( $res > 0 );
return $res;
}
sub setGroups {
$_[0]->checkChoice( $_[1] );
return $_[1]->data->{enabledMods1}->[0]->setGroups( $_[1] );
my $res = $_[1]->data->{enabledMods1}->[0]->setGroups( $_[1] );
delete $_[1]->pdata->{_choice} if ( $res > 0 );
return $res;
}
1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment