From 82e2b8a8c0ad01225058bafd487f2656afb81704 Mon Sep 17 00:00:00 2001 From: Stepan Fedorko-Bartos Date: Fri, 16 Nov 2018 11:52:01 -0700 Subject: [PATCH] Code style changes --- src/api/core/two_factor.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/api/core/two_factor.rs b/src/api/core/two_factor.rs index 59b2a0c9..3571f1e2 100644 --- a/src/api/core/two_factor.rs +++ b/src/api/core/two_factor.rs @@ -561,14 +561,10 @@ fn verify_yubikey_otp(otp: String) -> JsonResult { let yubico = Yubico::new(); let config = Config::default().set_client_id(CONFIG.yubico_client_id.to_owned()).set_key(CONFIG.yubico_secret_key.to_owned()); - let result; - - if CONFIG.yubico_server.is_some() { - result = yubico.verify(otp, config.set_api_hosts(vec![CONFIG.yubico_server.to_owned().unwrap()])); - } - else { - result = yubico.verify(otp, config); - } + let result = match CONFIG.yubico_server { + Some(ref server) => yubico.verify(otp, config.set_api_hosts(vec![server.to_owned()])), + None => yubico.verify(otp, config) + }; match result { Ok(_answer) => Ok(Json(json!({}))),