5
0
mirror of git://git.proxmox.com/git/pve-access-control.git synced 2025-01-20 14:03:43 +03:00

update tfa cleanup when deleting users

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-11-09 12:27:03 +01:00 committed by Thomas Lamprecht
parent 8c1e3ab3e9
commit d168ab34d6
2 changed files with 11 additions and 1 deletions

View File

@ -453,7 +453,7 @@ __PACKAGE__->register_method ({
my $partial_deletion = '';
eval {
PVE::AccessControl::user_set_tfa($userid, $realm, undef, undef, $usercfg, $domain_cfg);
PVE::AccessControl::user_remove_tfa($userid);
$partial_deletion = ' - but deleted related TFA';
PVE::AccessControl::delete_user_group($userid, $usercfg);

View File

@ -1740,6 +1740,16 @@ sub assert_new_tfa_config_available() {
# FIXME: Assert cluster-wide new-tfa-config support!
}
sub user_remove_tfa : prototype($) {
my ($userid) = @_;
assert_new_tfa_config_available();
my $tfa_cfg = cfs_read_file('priv/tfa.cfg');
$tfa_cfg->remove_user($userid);
cfs_write_file('priv/tfa.cfg', $tfa_cfg);
}
sub user_get_tfa : prototype($$$) {
my ($username, $realm, $new_format) = @_;