Commit 338abbbc authored by Christophe Maudoux's avatar Christophe Maudoux

Improve sfRequired test

parent a26b7867
...@@ -498,21 +498,21 @@ sub tests { ...@@ -498,21 +498,21 @@ sub tests {
required2FA => sub { required2FA => sub {
return 1 unless ( $conf->{sfRequired} ); return 1 unless ( $conf->{sfRequired} );
my $enable2fModule = 0; my $msg = '';
foreach (qw(u totp utotp yubikey)) { my $ok = 0;
$enable2fModule ||= $conf->{ $_ . '2fActivation' };
}
my $registrable2fModule = 0;
foreach (qw(u totp yubikey)) { foreach (qw(u totp yubikey)) {
$registrable2fModule ||= $conf->{ $_ . '2fSelfRegistration' }; $ok ||= $conf->{ $_ . '2fActivation' }
&& $conf->{ $_ . '2fSelfRegistration' };
} }
return ( 1, $ok ||= $conf->{'utotp2fActivation'}
"At least one self registrable 2F module should be enabled to require 2FA" && ( $conf->{'u2fSelfRegistration'}
) unless ( $enable2fModule && $registrable2fModule ); || $conf->{'totp2fSelfRegistration'} );
$msg = "A self registrable module should be enabled to require 2FA"
unless ($ok);
# Return return ( 1, $msg );
return 1;
}, },
# Error if external 2F Send or Validate command is missing # Error if external 2F Send or Validate command is missing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment