2017-02-17 08:40:18 +01:00
|
|
|
package Lemonldap::NG::Portal::Plugins::History;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
2020-10-09 22:26:00 +02:00
|
|
|
use Lemonldap::NG::Portal::Main::Constants qw(
|
|
|
|
PE_OK
|
|
|
|
PE_INFO
|
|
|
|
);
|
2017-02-17 08:40:18 +01:00
|
|
|
|
2020-10-09 22:26:00 +02:00
|
|
|
our $VERSION = '2.0.10';
|
2017-02-28 21:53:19 +01:00
|
|
|
|
2020-10-09 22:26:00 +02:00
|
|
|
extends qw(
|
|
|
|
Lemonldap::NG::Portal::Main::Plugin
|
|
|
|
Lemonldap::NG::Portal::Lib::OtherSessions
|
|
|
|
);
|
2017-02-17 08:40:18 +01:00
|
|
|
|
2017-03-23 13:41:52 +01:00
|
|
|
# INITIALIZATION
|
|
|
|
|
2018-09-05 09:19:01 +02:00
|
|
|
use constant endAuth => 'run';
|
2017-02-17 08:40:18 +01:00
|
|
|
|
2017-02-19 08:17:48 +01:00
|
|
|
sub init { 1 }
|
|
|
|
|
2017-03-23 13:41:52 +01:00
|
|
|
# RUNNING METHOD
|
|
|
|
|
2017-02-17 08:40:18 +01:00
|
|
|
sub run {
|
|
|
|
my ( $self, $req ) = @_;
|
2020-05-24 00:04:33 +02:00
|
|
|
|
2017-02-19 08:17:48 +01:00
|
|
|
if ( $req->param('checkLogins') ) {
|
|
|
|
$self->logger->debug('History asked');
|
2019-02-07 09:27:56 +01:00
|
|
|
$req->info( (
|
2017-03-21 22:00:37 +01:00
|
|
|
$req->sessionInfo->{_loginHistory}->{successLogin}
|
2019-06-28 13:40:56 +02:00
|
|
|
? $self->p->mkSessionArray( $req,
|
2017-03-21 22:00:37 +01:00
|
|
|
$req->sessionInfo->{_loginHistory}->{successLogin},
|
2017-02-19 08:17:48 +01:00
|
|
|
'lastLogins', 0, 0 )
|
|
|
|
: ""
|
2018-10-12 10:04:03 +02:00
|
|
|
)
|
|
|
|
. ("<hr>")
|
|
|
|
. (
|
2017-03-21 22:00:37 +01:00
|
|
|
$req->sessionInfo->{_loginHistory}->{failedLogin}
|
2019-06-28 13:40:56 +02:00
|
|
|
? $self->p->mkSessionArray( $req,
|
2017-03-21 22:00:37 +01:00
|
|
|
$req->sessionInfo->{_loginHistory}->{failedLogin},
|
2017-02-19 08:17:48 +01:00
|
|
|
'lastFailedLogins', 0, 1 )
|
|
|
|
: ""
|
2018-10-12 10:04:03 +02:00
|
|
|
)
|
2017-02-19 08:17:48 +01:00
|
|
|
);
|
2020-02-25 22:01:04 +01:00
|
|
|
$req->info( $self->loadTemplate( $req, 'noHistory' ) )
|
|
|
|
unless ( $req->info );
|
2017-02-19 08:17:48 +01:00
|
|
|
return PE_INFO;
|
|
|
|
}
|
|
|
|
return PE_OK;
|
2017-02-17 08:40:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|