catch incompatible tfa entries with a nice error

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-11-17 12:34:40 +01:00
parent 92bca71e86
commit 93c1d74a62
2 changed files with 6 additions and 1 deletions

View File

@ -185,6 +185,9 @@ __PACKAGE__->register_method({
if (!defined($tfa_type)) {
raise('no u2f data available');
}
if ($tfa_type eq 'incompatible') {
raise('tfa entries incompatible with old login api');
}
eval {
if ($tfa_type eq 'u2f') {

View File

@ -741,7 +741,9 @@ sub authenticate_2nd_old : prototype($$$) {
my ($type, $tfa_data) = user_get_tfa($username, $realm, 0);
if ($type) {
if ($type eq 'u2f') {
if ($type eq 'incompatible') {
die "old login api disabled, user has incompatible TFA entries\n";
} elsif ($type eq 'u2f') {
# Note that if the user did not manage to complete the initial u2f registration
# challenge we have a hash containing a 'challenge' entry in the user's tfa.cfg entry:
$tfa_data = undef if exists $tfa_data->{challenge};