storeHistory step is called before afterData if login process fails
Portal::Main::Process
sub authenticate {
my ( $self, $req ) = @_;
my $ret = $req->authResult( $self->_authentication->authenticate($req) );
$self->logger->debug( " -> authResult = " . $req->authResult );
if ( $ret == PE_OK ) {
$req->{sessionInfo}->{_lastAuthnUTime} = time();
return $ret;
}
# Store failed login into history
$req->steps( [
'setSessionInfo', 'setMacros',
'setPersistentSessionInfo', 'storeHistory',
@{ $self->afterData }, sub { PE_BADCREDENTIALS }
]
);
storeHistory is called before @{ $self->afterData }
Portal::Main::Run
sub login {
my ( $self, $req ) = @_;
return $self->do(
$req,
[
'checkUnauthLogout', 'controlUrl', # Fix 2342
@{ $self->beforeAuth }, $self->authProcess,
@{ $self->betweenAuthAndData }, $self->sessionData,
@{ $self->afterData }, $self->validSession,
@{ $self->endAuth }
]
);
}
sub validSession {
qw(storeHistory buildCookie);
}
$self->validSession is called after @{ $self->afterData }
So plugin like newLocationWarning can not use afterData entry point because history is stored before the plugin is called if login process fails.