mirror of
https://github.com/moghtech/komodo.git
synced 2026-05-04 23:09:34 -05:00
cli support clearing users 2fa methods
This commit is contained in:
committed by
Maxwell Becker
parent
5ba96a58e4
commit
c3626e0949
@@ -26,6 +26,9 @@ pub async fn update(
|
||||
UpdateUserCommand::SuperAdmin { enabled, yes } => {
|
||||
update_super_admin(username, *enabled, *yes).await
|
||||
}
|
||||
UpdateUserCommand::Clear2fa { yes } => {
|
||||
clear_2fa(username, *yes).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,3 +123,20 @@ async fn update_super_admin(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn clear_2fa(username: &str, yes: bool) -> anyhow::Result<()> {
|
||||
println!("\n{}: Clear 2FA Methods\n", "Mode".dimmed());
|
||||
println!(" - {}: {username}", "Username".dimmed());
|
||||
|
||||
crate::command::wait_for_enter("clear user 2FA methods", yes)?;
|
||||
|
||||
info!("Clearing 2FA methods...");
|
||||
|
||||
let db = database::Client::new(&cli_config().database).await?;
|
||||
|
||||
db.clear_user_2fa_methods(username).await?;
|
||||
|
||||
info!("2FA methods cleared ✅");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user