Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2025-02-07 11:17:02 +01:00
Review fixes
Dieser Commit ist enthalten in:
Ursprung
3617be0098
Commit
b9e257b469
2 geänderte Dateien mit 11 neuen und 34 gelöschten Zeilen
|
@ -94,7 +94,8 @@ pub struct SetPasswordData {
|
|||
keys: Option<KeysData>,
|
||||
master_password_hash: String,
|
||||
master_password_hint: Option<String>,
|
||||
// org_identifier: Option<String>,
|
||||
#[allow(dead_code)]
|
||||
org_identifier: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
@ -274,14 +275,15 @@ async fn post_set_password(data: Json<SetPasswordData>, 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<Vec<String>> = 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 {
|
||||
|
|
|
@ -59,8 +59,7 @@ pub fn routes() -> Vec<Route> {
|
|||
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<Value>
|
|||
|
||||
// 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/<org_id>/policies/invited-user?<userId>")]
|
||||
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<Value> = 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/<org_id>/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(),
|
||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren