tfa: r#type parameter name

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-12-14 16:32:42 +01:00
parent 1fc9ac0433
commit d831846706

View File

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