Fix badcredentials display (#1536)

environments/ppa-mbqj77/deployments/457
Christophe Maudoux 7 years ago
parent 7df60890e6
commit 48c5ccc34f
  1. 24
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm

@ -150,13 +150,33 @@ sub verify {
)
{
$self->userLogger->warn('Yubikey not registered');
return PE_BADCREDENTIALS;
$req->error(PE_BADCREDENTIALS);
return $self->fail($req);
}
if ( $self->yubi->otp($code) ne 'OK' ) {
$self->userLogger->warn('Yubikey verification failed');
return PE_BADCREDENTIALS;
$req->error(PE_BADCREDENTIALS);
return $self->fail($req);
}
PE_OK;
}
sub fail {
my ( $self, $req ) = @_;
$req->response(
$self->p->sendHtml(
$req,
'u2fcheck',
params => {
MAIN_LOGO => $self->conf->{portalMainLogo},
AUTH_ERROR => $req->error,
AUTH_ERROR_TYPE => $req->error_type,
SKIN => $self->conf->{portalSkin},
FAILED => 1
}
)
);
return PE_SENDRESPONSE;
}
1

Loading…
Cancel
Save