|
|
@ -520,16 +520,18 @@ async fn password_login( |
|
|
authenticated_response(&user, &mut device, auth_tokens, twofactor_token, conn, ip).await |
|
|
authenticated_response(&user, &mut device, auth_tokens, twofactor_token, conn, ip).await |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Like upstream's `ClientVersionValidator`, every login needs the `Bitwarden-Client-Version` header, and a V2 account a
|
|
|
/// Like upstream's `ClientVersionValidator`, every login needs the `Bitwarden-Client-Version` header, and a V2 account
|
|
|
/// client of at least 2026.10.1 (2026.10.2 for the desktop app). Called right after the credentials are checked, like
|
|
|
/// ([`User::has_v2_encryption`]) a client of at least 2026.10.1 (2026.10.2 for the desktop app). Called right after the
|
|
|
/// upstream, so that it doesn't tell anyone else which accounts are V2.
|
|
|
/// credentials are checked, like upstream, so that it doesn't tell anyone else which accounts are V2.
|
|
|
///
|
|
|
///
|
|
|
/// Ref: <https://github.com/bitwarden/server/blob/15c94ac58bf361a162381749c146d254a21b2098/src/Identity/IdentityServer/RequestValidators/ClientVersionValidator.cs#L33-L79>
|
|
|
/// Ref: <https://github.com/bitwarden/server/blob/15c94ac58bf361a162381749c146d254a21b2098/src/Identity/IdentityServer/RequestValidators/ClientVersionValidator.cs#L33-L79>
|
|
|
/// Ref: <https://github.com/bitwarden/server/blob/15c94ac58bf361a162381749c146d254a21b2098/src/Core/KeyManagement/Constants.cs#L5-L6>
|
|
|
/// Ref: <https://github.com/bitwarden/server/blob/15c94ac58bf361a162381749c146d254a21b2098/src/Core/KeyManagement/Constants.cs#L5-L6>
|
|
|
fn check_client_version(user: &User, client_header: &ClientHeaders) -> EmptyResult { |
|
|
fn check_client_version(user: &User, client_header: &ClientHeaders) -> EmptyResult { |
|
|
let Some((error, description)) = |
|
|
let Some((error, description)) = client_version_error( |
|
|
client_version_error(user.is_v2(), client_header.client_version.as_ref(), client_header.device_type) |
|
|
user.has_v2_encryption(), |
|
|
else { |
|
|
client_header.client_version.as_ref(), |
|
|
|
|
|
client_header.device_type, |
|
|
|
|
|
) else { |
|
|
return Ok(()); |
|
|
return Ok(()); |
|
|
}; |
|
|
}; |
|
|
Err(crate::error::Error::from(( |
|
|
Err(crate::error::Error::from(( |
|
|
|