diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/DBI.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/DBI.pm index 027ffb3f2..369379a56 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/DBI.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/DBI.pm @@ -50,10 +50,12 @@ sub getUser { # If connection isn't available, error is displayed by dbh() $self->logger->error("DBI error: $@") if ( $self->_dbh ); + eval { $self->p->_authentication->setSecurity($req) }; return PE_ERROR; } unless ( $req->datas->{entry} = $sth->fetchrow_hashref() ) { $self->userLogger->warn("User $user not found"); + eval { $self->p->_authentication->setSecurity($req) }; return PE_BADCREDENTIALS; } PE_OK; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/LDAP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/LDAP.pm index 268cf2512..979565a78 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/LDAP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/LDAP.pm @@ -56,11 +56,13 @@ sub getUser { } if ( $mesg->count() > 1 ) { $self->logger->error('More than one entry returned by LDAP directory'); + eval { $self->p->_authentication->setSecurity($req) }; return PE_BADCREDENTIALS; } unless ( $req->datas->{entry} = $mesg->entry(0) ) { my $user = $req->{mail} || $req->{user}; $self->userLogger->warn("$user was not found in LDAP directory"); + eval { $self->p->_authentication->setSecurity($req) }; return PE_BADCREDENTIALS; } $req->datas->{dn} = $req->datas->{entry}->dn();