From 948554a20fd46acc7155303985b9517607b246b9 Mon Sep 17 00:00:00 2001 From: Daniel GarcĂ­a Date: Thu, 13 Sep 2018 20:59:51 +0200 Subject: Added config option for websocket port, and reworked the config parsing a bit. Added SMTP_FROM config to examples and made it mandatory, it doesn't make much sense to not specify the from address. --- src/api/identity.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/api/identity.rs') diff --git a/src/api/identity.rs b/src/api/identity.rs index e1994c00..da27ff61 100644 --- a/src/api/identity.rs +++ b/src/api/identity.rs @@ -162,7 +162,7 @@ fn twofactor_auth( return Ok(None); } - let provider = match util::parse_option_string(data.get_opt("twoFactorProvider")) { + let provider = match util::try_parse_string(data.get_opt("twoFactorProvider")) { Some(provider) => provider, None => providers[0], // If we aren't given a two factor provider, asume the first one }; @@ -207,7 +207,7 @@ fn twofactor_auth( _ => err!("Invalid two factor provider"), } - if util::parse_option_string(data.get_opt("twoFactorRemember")).unwrap_or(0) == 1 { + if util::try_parse_string_or(data.get_opt("twoFactorRemember"), 0) == 1 { Ok(Some(device.refresh_twofactor_remember())) } else { device.delete_twofactor_remember(); @@ -274,7 +274,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for DeviceType { fn from_request(request: &'a Request<'r>) -> request::Outcome { let headers = request.headers(); let type_opt = headers.get_one("Device-Type"); - let type_num = util::parse_option_string(type_opt).unwrap_or(0); + let type_num = util::try_parse_string_or(type_opt, 0); Outcome::Success(DeviceType(type_num)) } -- cgit v1.2.3