Reinitialize choice when module failed (#1461)
This commit is contained in:
parent
ea48c78a28
commit
1da367576e
|
@ -22,6 +22,7 @@ our $page_title = 'Lemonldap::NG statistics';
|
||||||
# @return Constant hash used to convert error codes into string.
|
# @return Constant hash used to convert error codes into string.
|
||||||
sub portalTab {
|
sub portalTab {
|
||||||
return {
|
return {
|
||||||
|
-5 => 'PORTAL_IDPCHOICE',
|
||||||
-4 => 'PORTAL_SENDRESPONSE',
|
-4 => 'PORTAL_SENDRESPONSE',
|
||||||
-3 => 'PORTAL_INFO',
|
-3 => 'PORTAL_INFO',
|
||||||
-2 => 'PORTAL_REDIRECT',
|
-2 => 'PORTAL_REDIRECT',
|
||||||
|
|
|
@ -23,17 +23,23 @@ sub extractFormInfo {
|
||||||
}
|
}
|
||||||
return PE_FIRSTACCESS;
|
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 {
|
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 {
|
sub setAuthSessionInfo {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
$self->checkChoice($req) unless ( $req->data->{enabledMods0} );
|
$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 {
|
sub authLogout {
|
||||||
|
|
|
@ -10,6 +10,7 @@ use constant {
|
||||||
|
|
||||||
# Portal errors
|
# Portal errors
|
||||||
# Developers warning, do not use PE_INFO, it's reserved to autoRedirect.
|
# Developers warning, do not use PE_INFO, it's reserved to autoRedirect.
|
||||||
|
PE_IDPCHOICE => -5,
|
||||||
PE_SENDRESPONSE => -4,
|
PE_SENDRESPONSE => -4,
|
||||||
PE_INFO => -3,
|
PE_INFO => -3,
|
||||||
PE_REDIRECT => -2,
|
PE_REDIRECT => -2,
|
||||||
|
@ -90,7 +91,6 @@ use constant {
|
||||||
PE_U2FFAILED => 83,
|
PE_U2FFAILED => 83,
|
||||||
PE_UNAUTHORIZEDPARTNER => 84,
|
PE_UNAUTHORIZEDPARTNER => 84,
|
||||||
PE_RENEWSESSION => 85,
|
PE_RENEWSESSION => 85,
|
||||||
PE_IDPCHOICE => 86,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# EXPORTER PARAMETERS
|
# EXPORTER PARAMETERS
|
||||||
|
|
|
@ -19,16 +19,22 @@ sub init {
|
||||||
sub getUser {
|
sub getUser {
|
||||||
my ( $self, $req, %args ) = @_;
|
my ( $self, $req, %args ) = @_;
|
||||||
$self->checkChoice($req) or return PE_FIRSTACCESS;
|
$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 {
|
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 {
|
sub setGroups {
|
||||||
$_[0]->checkChoice( $_[1] );
|
$_[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;
|
1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user