diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs index 002db490..2af07d9d 100644 --- a/src/api/core/accounts.rs +++ b/src/api/core/accounts.rs @@ -94,7 +94,8 @@ pub struct SetPasswordData { keys: Option, master_password_hash: String, master_password_hint: Option, - // org_identifier: Option, + #[allow(dead_code)] + org_identifier: Option, } #[derive(Debug, Deserialize)] @@ -274,14 +275,15 @@ async fn post_set_password(data: Json, headers: Headers, mut co user.client_kdf_type = client_kdf_type; } - // We need to allow revision-date to use the old security_timestamp - let routes = ["revision_date"]; - let routes: Option> = Some(routes.iter().map(ToString::to_string).collect()); - user.client_kdf_memory = data.kdf_memory; user.client_kdf_parallelism = data.kdf_parallelism; - user.set_password(&data.master_password_hash, Some(data.key), false, routes); + user.set_password( + &data.master_password_hash, + Some(data.key), + false, + Some(vec![String::from("revision_date")]), // We need to allow revision-date to use the old security_timestamp + ); user.password_hint = password_hint; if let Some(keys) = data.keys { diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 5397497b..8c118849 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -59,8 +59,7 @@ pub fn routes() -> Vec { post_org_import, list_policies, list_policies_token, - list_policies_invited_user, - get_policy_master_password, + get_master_password_policy, get_policy, put_policy, get_organization_tax, @@ -313,7 +312,7 @@ async fn get_user_collections(headers: Headers, mut conn: DbConn) -> Json // Called during the SSO enrollment // The `_identifier` should be the harcoded value returned by `get_org_domain_sso_details` -// The returned `Id` will then be passed to `get_policy_master_password` which will mainly ignore it +// The returned `Id` will then be passed to `get_master_password_policy` which will mainly ignore it #[get("/organizations/<_identifier>/auto-enroll-status")] fn get_auto_enroll_status(_identifier: &str) -> JsonResult { Ok(Json(json!({ @@ -1834,33 +1833,9 @@ async fn list_policies_token(org_id: &str, token: &str, mut conn: DbConn) -> Jso }))) } -// Called during the SSO enrollment. -// Since the VW SSO flow is not linked to an organization it will be called with a dummy or undefined `org_id` -#[allow(non_snake_case)] -#[get("/organizations//policies/invited-user?")] -async fn list_policies_invited_user(org_id: &str, userId: &str, mut conn: DbConn) -> JsonResult { - if userId.is_empty() { - err!("userId must not be empty"); - } - - let user_orgs = UserOrganization::find_invited_by_user(userId, &mut conn).await; - let policies_json: Vec = if user_orgs.into_iter().any(|user_org| user_org.org_uuid == org_id) { - let policies = OrgPolicy::find_by_org(org_id, &mut conn).await; - policies.iter().map(OrgPolicy::to_json).collect() - } else { - Vec::with_capacity(0) - }; - - Ok(Json(json!({ - "Data": policies_json, - "Object": "list", - "ContinuationToken": null - }))) -} - // Called during the SSO enrollment. #[get("/organizations//policies/master-password", rank = 1)] -fn get_policy_master_password(org_id: &str, _headers: Headers) -> JsonResult { +fn get_master_password_policy(org_id: &str, _headers: Headers) -> JsonResult { let data = match CONFIG.sso_master_password_policy() { Some(policy) => policy, None => "null".to_string(),