Merge pull request #922 from jjlin/device-push-token

Handle `devicePushToken`
This commit is contained in:
Daniel García 2020-03-23 00:03:10 +01:00 committed by GitHub
commit 91dd19473d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -347,6 +347,7 @@ fn _json_err_twofactor(providers: &[i32], user_uuid: &str, conn: &DbConn) -> Api
Ok(result) Ok(result)
} }
// https://github.com/bitwarden/mobile/blob/master/src/Core/Models/Request/TokenRequest.cs
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
#[allow(non_snake_case)] #[allow(non_snake_case)]
struct ConnectData { struct ConnectData {
@ -364,6 +365,7 @@ struct ConnectData {
device_identifier: Option<String>, device_identifier: Option<String>,
device_name: Option<String>, device_name: Option<String>,
device_type: Option<String>, device_type: Option<String>,
device_push_token: Option<String>, // Unused; mobile device push not yet supported.
// Needed for two-factor auth // Needed for two-factor auth
two_factor_provider: Option<i32>, two_factor_provider: Option<i32>,
@ -391,6 +393,7 @@ impl<'f> FromForm<'f> for ConnectData {
"deviceidentifier" => form.device_identifier = Some(value), "deviceidentifier" => form.device_identifier = Some(value),
"devicename" => form.device_name = Some(value), "devicename" => form.device_name = Some(value),
"devicetype" => form.device_type = Some(value), "devicetype" => form.device_type = Some(value),
"devicepushtoken" => form.device_push_token = Some(value),
"twofactorprovider" => form.two_factor_provider = value.parse().ok(), "twofactorprovider" => form.two_factor_provider = value.parse().ok(),
"twofactortoken" => form.two_factor_token = Some(value), "twofactortoken" => form.two_factor_token = Some(value),
"twofactorremember" => form.two_factor_remember = value.parse().ok(), "twofactorremember" => form.two_factor_remember = value.parse().ok(),