Fix history bugs (fixes: #1401)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 7 years ago
parent 3499b07a6b
commit 3836391adc
  1. 8
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
  2. 5
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
  3. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/AutoSignin.pm
  4. 11
      lemonldap-ng-portal/t/63-History.t

@ -482,4 +482,12 @@ sub secondFactor {
return $self->_sfEngine->run($req);
}
sub storeHistory {
my ( $self, $req ) = @_;
if ( $self->conf->{loginHistoryEnabled} ) {
$self->registerLogin($req);
}
PE_OK;
}
1;

@ -20,7 +20,7 @@ sub authProcess { qw(extractFormInfo getUser authenticate) }
sub sessionDatas {
qw(setAuthSessionInfo setSessionInfo setMacros setGroups setPersistentSessionInfo
setLocalGroups store secondFactor buildCookie);
setLocalGroups store secondFactor storeHistory buildCookie);
}
# RESPONSE HANDLER
@ -171,9 +171,6 @@ sub do {
}
# Update history
if ( $self->conf->{loginHistoryEnabled} ) {
$self->registerLogin($req);
}
if ( $err == PE_SENDRESPONSE ) {
return $req->response;
}

@ -48,8 +48,10 @@ sub check {
if ( $test->( $req->env ) ) {
$req->user($name);
my @steps =
grep { !ref $_ and $_ !~ /^(?:extractFormInfo|authenticate)$/ }
@{ $req->steps };
grep {
!ref $_
and $_ !~ /^(?:extractFormInfo|authenticate|secondFactor)$/
} @{ $req->steps };
$req->steps( \@steps );
$self->userLogger->notice("Autosignin for $name");
return PE_OK;

@ -32,8 +32,11 @@ ok(
count(1);
expectOK($res);
my $id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="noHistory"/, 'No history found' );
count(1);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
or explain( $res->[2]->[0], 'trspan="noHistory"' );
my @c = ( $res->[2]->[0] =~ /<td>127.0.0.1/gs );
ok( @c == 1, 'One entry found' );
count(2);
ok( $res = $client->_get( '/', cookie => "lemonldap=$id1" ),
'Verify connection' );
@ -57,7 +60,9 @@ expectOK($res);
$id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' );
count(1);
@c = ( $res->[2]->[0] =~ /<td>127.0.0.1/gs );
ok( @c == 2, 'Two entries found' );
count(2);
clean_sessions();

Loading…
Cancel
Save