diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm index 786795a48..c940c306a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -174,7 +174,11 @@ sub verify { # Verify OTP my $yubikey = $self->_findYubikey( $req, $session ); - unless ( $yubikey ) { + if ( + index( $yubikey, + substr( $code, 0, $self->conf->{yubikey2fPublicIDSize} ) ) == -1 + ) + { $self->userLogger->warn('Yubikey not registered'); return PE_BADOTP; }