]> git.proxmox.com Git - pve-access-control.git/commitdiff
tfa: fix http 404 in get_tfa_entry
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 12 Nov 2021 09:37:45 +0000 (10:37 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 12 Nov 2021 10:01:48 +0000 (11:01 +0100)
this produced warnings in the journal and returned code 500
instead

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/API2/TFA.pm

index 87d725573821ff3b408049e0a9c21a4a69739bde..657a74ce1355e8b2251a7b42943f37085ee46e0b 100644 (file)
@@ -3,6 +3,8 @@ package PVE::API2::TFA;
 use strict;
 use warnings;
 
+use HTTP::Status qw(:constants);
+
 use PVE::AccessControl;
 use PVE::Cluster qw(cfs_read_file cfs_write_file);
 use PVE::JSONSchema qw(get_standard_option);
@@ -280,7 +282,7 @@ __PACKAGE__->register_method ({
        my $tfa_cfg = cfs_read_file('priv/tfa.cfg');
        my $id = $param->{id};
        my $entry = $tfa_cfg->api_get_tfa_entry($param->{userid}, $id);
-       raise("No such tfa entry '$id'", 404) if !$entry;
+       raise("No such tfa entry '$id'", code => HTTP::Status::HTTP_NOT_FOUND) if !$entry;
        return $entry;
     }});