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 be5d053db..782cb653a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -52,10 +52,18 @@ sub init { $self->yubi( Auth::Yubikey_WebClient->new( { - id => $self->conf->{yubikey2fClientID}, - api => $self->conf->{yubikey2fSecretKey}, - nonce => $self->conf->{yubikey2fNonce}, - url => $self->conf->{yubikey2fUrl} + id => $self->conf->{yubikey2fClientID}, + api => $self->conf->{yubikey2fSecretKey}, + ( + $self->conf->{yubikey2fNonce} + ? ( nonce => $self->conf->{yubikey2fNonce} ) + : () + ), + ( + $self->conf->{yubikey2fUrl} + ? ( url => $self->conf->{yubikey2fUrl} ) + : () + ), } ) );