HEXIT('ERR_SECURITY_VIOLATION', msg => "You can't reset the TOTP of an admin without being admin yourself");
}
if (OVH::Bastion::is_user_in_group(user => $account, group => OVH::Bastion::MFA_TOTP_CONFIGURED_GROUP)) {
$fnret = OVH::Bastion::sys_delmemberfromgroup(user => $account, group => OVH::Bastion::MFA_TOTP_CONFIGURED_GROUP);
$fnret or HEXIT($fnret);
}
# remove the .otp file (non-fatal)
if (!unlink($home . '/' . OVH::Bastion::TOTP_FILENAME)) {
osh_warn("Couldn't remove the TOTP file ($!), this is not fatal, continuing anyway");
}
osh_info "TOTP has been reset, " . ($account eq $self ? 'you' : $account) . " can re-enroll by using the `--osh selfMFASetupTOTP' command, if applicable";