aboutsummaryrefslogtreecommitdiff
path: root/src/api/identity.rs
diff options
context:
space:
mode:
authorDaniel García <[email protected]>2018-09-13 20:59:51 +0200
committerDaniel García <[email protected]>2018-09-13 20:59:51 +0200
commit948554a20fd46acc7155303985b9517607b246b9 (patch)
treefc64750616ef43bbddaf0a6fa5a8e3533770d3b1 /src/api/identity.rs
parent9cdb605659f557ecfd5a90e00154fb0b58c8ec9b (diff)
downloadvaultwarden-948554a20fd46acc7155303985b9517607b246b9.tar.gz
vaultwarden-948554a20fd46acc7155303985b9517607b246b9.zip
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.
Diffstat (limited to 'src/api/identity.rs')
-rw-r--r--src/api/identity.rs6
1 files changed, 3 insertions, 3 deletions
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<Self, Self::Error> {
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))
}