Delete pdata on logout (#1461)

environments/ppa-mbqj77/deployments/159
Xavier Guimard 7 years ago
parent 0f7b3ca71d
commit aa1e9b44d5
  1. 7
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
  2. 12
      lemonldap-ng-portal/t/28-AuthChoice.t
  3. 3
      lemonldap-ng-portal/t/test-lib.pm

@ -137,7 +137,12 @@ sub checkLogout {
sub authLogout {
my ( $self, $req ) = @_;
return $self->_authentication->authLogout($req);
my $res = $self->_authentication->authLogout($req);
unless ( $res or $req->pdata->{keepPdata} ) {
$self->logger->debug('Cleaning pdata');
$req->pdata( {} );
}
return $res;
}
sub deleteSession {

@ -5,7 +5,7 @@ use IO::String;
require 't/test-lib.pm';
my $res;
my $maintests = 2;
my $maintests = 6;
eval { unlink 't/userdb.db' };
@ -59,14 +59,20 @@ SKIP: {
# Try yo authenticate
# -------------------
ok( $res = $client->_get('/',accept=>'text/html'), 'Get menu');
my @form = ($res->[2]->[0] =~ m#<form.*?</form>#sg);
ok(@form ==2,'Display 2 choices');
foreach (@form) {
expectForm([$res->[0],$res->[1],[$_]],undef,undef,'test');
}
ok(
$res = $client->_post(
'/', IO::String->new($postString),
length => length($postString)
length => length($postString),
accept => 'text/html',
),
'Auth query'
);
expectOK($res);
my $id = expectCookie($res);
$client->logout($id);
}

@ -335,12 +335,13 @@ sub logout {
( defined( $c = main::getCookies($res)->{lemonldap} ) and not $c ),
' Cookie is deleted' )
or main::explain( $res->[1], "Set-Cookie => 'lemonldap='" );
main::ok( not( main::getCookies($res)->{lemonldappdata} ), ' No pdata' );
main::ok( $res = $self->_get( '/', cookie => "lemonldap=$id" ),
'Disconnect request' )
or explain( $res, '[<code>,<hdrs>,<content>]' );
main::ok( $res->[0] == 401, ' Response is 401' )
or main::explain( $res, 401 );
main::count(5);
main::count(6);
}

Loading…
Cancel
Save