From e7d7ef1e0a5c0212facb02f2c36a6a5c101c732f Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Sat, 22 Sep 2018 10:14:29 +0200 Subject: [PATCH] FIX logins history display (#1501) --- .../lib/Lemonldap/NG/Portal/Main/Process.pm | 3 ++- .../lib/Lemonldap/NG/Portal/Main/Run.pm | 2 ++ .../Lemonldap/NG/Portal/Plugins/History.pm | 8 ++++++-- .../site/templates/bootstrap/info.tpl | 20 +++++++++---------- .../site/templates/bootstrap/sessionArray.tpl | 4 ++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm index a8bbed107..9e804084d 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm @@ -284,7 +284,7 @@ sub getUser { sub authenticate { my ( $self, $req ) = @_; my $ret = $req->authResult( $self->_authentication->authenticate($req) ); - $self->logger->debug(" -> authResult = $ret"); + $self->logger->debug(" -> authResult = " . $req->authResult); if ( $ret == PE_OK ) { $req->{sessionInfo}->{_lastAuthnUTime} = time(); return $ret; @@ -297,6 +297,7 @@ sub authenticate { sub {PE_BADCREDENTIALS} ] ); + return PE_OK; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm index 15d022aa6..fa86f4988 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -843,6 +843,8 @@ sub registerLogin { $login->{error} = $self->error( $req->authResult ) if ( $req->authResult ); + $self->logger->debug(" Current login -> " . $login->{error} ); + # Add current login into history unshift @{ $history->{$type} }, $login; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm index 6890ec60c..5650bd10f 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm @@ -1,5 +1,6 @@ package Lemonldap::NG::Portal::Plugins::History; +use Data::Dumper; use strict; use Mouse; use Lemonldap::NG::Portal::Main::Constants qw(PE_INFO PE_OK); @@ -21,6 +22,8 @@ sub run { my ( $self, $req ) = @_; if ( $req->param('checkLogins') ) { $self->logger->debug('History asked'); + $self->logger->debug(' successLogins -> ' . Dumper($req->sessionInfo->{_loginHistory}->{successLogin} )); + $self->logger->debug(' failedLogins -> ' . Dumper($req->sessionInfo->{_loginHistory}->{failedLogin} )); $req->info( ( $req->sessionInfo->{_loginHistory}->{successLogin} @@ -28,8 +31,9 @@ sub run { $req->sessionInfo->{_loginHistory}->{successLogin}, 'lastLogins', 0, 0 ) : "" - ) - . ( + ) + . ("
") . + ( $req->sessionInfo->{_loginHistory}->{failedLogin} ? $self->p->mkSessionArray( $req->sessionInfo->{_loginHistory}->{failedLogin}, diff --git a/lemonldap-ng-portal/site/templates/bootstrap/info.tpl b/lemonldap-ng-portal/site/templates/bootstrap/info.tpl index 951b83ba5..ccc83b823 100644 --- a/lemonldap-ng-portal/site/templates/bootstrap/info.tpl +++ b/lemonldap-ng-portal/site/templates/bootstrap/info.tpl @@ -19,16 +19,16 @@

You'll be redirected in 30 seconds

-
- - -
+
+ + +