From 627548e95db451ea3243ce9aca3db88475f3edc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Mon, 18 Mar 2019 11:41:41 +0100 Subject: [PATCH 1/2] Display authentication error on login form (#1666) --- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index b700252ff..7d6448a24 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -352,8 +352,7 @@ sub display { # * Bad URL error elsif ($req->{error} == PE_LOGOUT_OK or $req->{error} == PE_WAIT - or $req->{error} == PE_BADURL - or $req->{error} == PE_BADCREDENTIALS ) + or $req->{error} == PE_BADURL ) { %templateParams = ( %templateParams, From 4366488fb657b15ccebcdfa7e309a06d36a574ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Mon, 18 Mar 2019 11:53:30 +0100 Subject: [PATCH 2/2] Adapt GrantSession plugin to display authentication error on login form (#1666) --- .../lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm | 7 ++++++- lemonldap-ng-portal/t/61-GrantSession.t | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm index 9ab0cad3d..43fbc1dd9 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm @@ -45,7 +45,12 @@ sub run { } # Avoid display notification if AuthResult is not null - return PE_BADCREDENTIALS if $req->authResult > PE_OK; + if ( $req->authResult > PE_OK ) { + $self->logger->debug( + "Bad authentication, do not check grant session rules"); + $req->userData( {} ); + return PE_BADCREDENTIALS; + } foreach ( sort sortByComment keys %{ $self->rules } ) { $self->logger->debug( "Grant session condition -> " diff --git a/lemonldap-ng-portal/t/61-GrantSession.t b/lemonldap-ng-portal/t/61-GrantSession.t index af99283a2..84db1f5ed 100644 --- a/lemonldap-ng-portal/t/61-GrantSession.t +++ b/lemonldap-ng-portal/t/61-GrantSession.t @@ -54,8 +54,8 @@ ok( $res->[2]->[0] =~ /<\/span><\/div>/, 'dwho rejected with PE_BADCREDENTIALS' ) or print STDERR Dumper( $res->[2]->[0] ); count(1); -ok( $res->[2]->[0] =~ m%Go to portal%, - 'Found goToPortal button' ) +ok( $res->[2]->[0] =~ m%Connect%, + 'Found connect button' ) or print STDERR Dumper( $res->[2]->[0] ); count(1); @@ -125,8 +125,8 @@ ok( 'rtyler rejected with PE_BADCREDENTIALS' ) or print STDERR Dumper( $res->[2]->[0] ); count(1); -ok( $res->[2]->[0] =~ m%Go to portal%, - 'Found goToPortal button' ) +ok( $res->[2]->[0] =~ m%Connect%, + 'Found connect button' ) or print STDERR Dumper( $res->[2]->[0] ); count(1);