Catch error earlier in process (#1867)

This commit is contained in:
Christophe Maudoux 2019-08-24 23:10:09 +02:00
parent 0415370f2c
commit ec59cc164c
5 changed files with 21 additions and 14 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -119,13 +119,6 @@ sub getDisplayType {
return $self->conf->{combinationForms}
if ( $self->conf->{combinationForms} );
if ( $req->{error} > PE_OK and $req->{error} != PE_FIRSTACCESS ) {
$self->logger->notice('Start over combination schema');
my $stack = $self->stackSub->( $req->env );
my ( $res, $name ) = $stack->[0]->[0]->( 'getDisplayType', $req );
return $res;
}
my ( $nb, $stack ) = (
$req->data->{dataKeep}->{combinationTry},
$req->data->{combinationStack}
@ -198,6 +191,7 @@ sub try {
# If more than 1 scheme is available
my ( $res, $name );
if ( $nb < @$stack - 1 ) {
# TODO: change logLevel for userLog()

View File

@ -2,7 +2,7 @@
# Display functions for LemonLDAP::NG Portal
package Lemonldap::NG::Portal::Main::Display;
our $VERSION = '2.0.5';
our $VERSION = '2.0.6';
package Lemonldap::NG::Portal::Main;
use strict;
@ -255,6 +255,13 @@ sub display {
or ( not $req->data->{noerror}
and $req->userData
and %{ $req->userData } )
# Avoid issue 1867
or ( $self->conf->{authentication} eq 'Combination'
and $req->{error} > PE_OK
and $req->{error} != PE_FIRSTACCESS )
# and ( $req->{error} == PE_TOKENEXPIRED or $req->{error} == PE_NOTOKEN )
)
{
$skinfile = 'error';

View File

@ -3,7 +3,7 @@ use strict;
use IO::String;
require 't/test-lib.pm';
my $maintests = 19;
my $maintests = 20;
SKIP: {
eval { require Convert::Base32 };
@ -24,7 +24,7 @@ SKIP: {
loginHistoryEnabled => 0,
authentication => 'Combination',
userDB => 'Same',
combination => '[Dm1] or [Dm2]',
combination => '[ssl, Dm1] or [Dm2]',
combModules => {
Dm1 => {
for => 0,
@ -34,6 +34,10 @@ SKIP: {
for => 0,
type => 'Demo',
},
ssl => {
for => 1,
type => 'SSL',
}
},
}
}
@ -161,10 +165,11 @@ SKIP: {
),
'Post code'
);
( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'token' );
ok( $res->[2]->[0] =~ /<span trmsg="82"><\/span>/, 'Token expired' )
or print STDERR Dumper( $res->[2]->[0] );
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Menu', );
my ( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'token' );
}
count($maintests);