From c06162b22fdf8f2cfa96b38ab1e679d1ed332b94 Mon Sep 17 00:00:00 2001 From: Jeremy Lin Date: Sun, 22 Mar 2020 15:04:25 -0700 Subject: [PATCH] Handle `devicePushToken` Mobile push isn't currently supported, but this should get rid of spurious `Detected unexpected parameter during login: devicepushtoken` warnings. --- src/api/identity.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/identity.rs b/src/api/identity.rs index 0c77d4f..ce432eb 100644 --- a/src/api/identity.rs +++ b/src/api/identity.rs @@ -347,6 +347,7 @@ fn _json_err_twofactor(providers: &[i32], user_uuid: &str, conn: &DbConn) -> Api Ok(result) } +// https://github.com/bitwarden/mobile/blob/master/src/Core/Models/Request/TokenRequest.cs #[derive(Debug, Clone, Default)] #[allow(non_snake_case)] struct ConnectData { @@ -364,6 +365,7 @@ struct ConnectData { device_identifier: Option, device_name: Option, device_type: Option, + device_push_token: Option, // Unused; mobile device push not yet supported. // Needed for two-factor auth two_factor_provider: Option, @@ -391,6 +393,7 @@ impl<'f> FromForm<'f> for ConnectData { "deviceidentifier" => form.device_identifier = Some(value), "devicename" => form.device_name = Some(value), "devicetype" => form.device_type = Some(value), + "devicepushtoken" => form.device_push_token = Some(value), "twofactorprovider" => form.two_factor_provider = value.parse().ok(), "twofactortoken" => form.two_factor_token = Some(value), "twofactorremember" => form.two_factor_remember = value.parse().ok(),