diff --git a/src/api2/access/tfa.rs b/src/api2/access/tfa.rs index e9a512ad..7f46f00f 100644 --- a/src/api2/access/tfa.rs +++ b/src/api2/access/tfa.rs @@ -408,17 +408,15 @@ fn add_tfa_entry( value: Option, challenge: Option, password: Option, - mut params: Value, // FIXME: once api macro supports raw parameters names, use `r#type` + r#type: TfaType, rpcenv: &mut dyn RpcEnvironment, ) -> Result { tfa_update_auth(rpcenv, &userid, password)?; - let tfa_type: TfaType = serde_json::from_value(params["type"].take())?; - let need_description = move || description.ok_or_else(|| format_err!("'description' is required for new entries")); - match tfa_type { + match r#type { TfaType::Totp => match (totp, value) { (Some(totp), Some(value)) => { if challenge.is_some() {