1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2025-01-31 10:08:56 +01:00
Dieser Commit ist enthalten in:
Timshel 2025-01-16 19:04:03 +01:00
Ursprung 6f9b88e572
Commit 0b556b21b0
3 geänderte Dateien mit 9 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -177,7 +177,7 @@ pub async fn _register(data: Json<RegisterData>, mut conn: DbConn) -> JsonResult
err!("Registration email does not match invite email")
}
} else if Invitation::take(&email, &mut conn).await {
Membership::confirm_user_invitations(&user.uuid, &mut conn).await?;
Membership::accept_user_invitations(&user.uuid, &mut conn).await?;
user
} else if CONFIG.is_signup_allowed(&email)
|| (CONFIG.emergency_access_allowed()
@ -298,7 +298,7 @@ async fn post_set_password(data: Json<SetPasswordData>, headers: Headers, mut co
if CONFIG.mail_enabled() {
mail::send_set_password(&user.email.to_lowercase(), &user.name).await?;
} else {
Membership::confirm_user_invitations(&user.uuid, &mut conn).await?;
Membership::accept_user_invitations(&user.uuid, &mut conn).await?;
}
user.save(&mut conn).await?;

Datei anzeigen

@ -12,7 +12,7 @@ use crate::{
auth::{decode_invite, AdminHeaders, ClientVersion, Headers, ManagerHeaders, ManagerHeadersLoose, OwnerHeaders},
db::{models::*, DbConn},
mail,
util::{convert_json_key_lcase_first, NumberOrString},
util::{convert_json_key_lcase_first, get_uuid, NumberOrString},
CONFIG,
};
@ -330,7 +330,7 @@ async fn get_user_collections(headers: Headers, mut conn: DbConn) -> Json<Value>
#[get("/organizations/<_identifier>/auto-enroll-status")]
fn get_auto_enroll_status(_identifier: &str) -> JsonResult {
Ok(Json(json!({
"Id": "_",
"Id": get_uuid(),
"ResetPasswordEnabled": false, // Not implemented
})))
}
@ -1882,18 +1882,14 @@ async fn list_policies_token(org_id: OrganizationId, token: &str, mut conn: DbCo
// Called during the SSO enrollment.
// Cannot use the OrganizationId guard since the Org does not exists.
#[get("/organizations/<org_id>/policies/master-password", rank = 1)]
fn get_master_password_policy(org_id: &str, _headers: Headers) -> JsonResult {
fn get_master_password_policy(org_id: OrganizationId, _headers: Headers) -> JsonResult {
let data = match CONFIG.sso_master_password_policy() {
Some(policy) => policy,
None => "null".to_string(),
};
let policy = OrgPolicy::new(
OrganizationId(org_id.to_string()),
OrgPolicyType::MasterPassword,
CONFIG.sso_master_password_policy().is_some(),
data,
);
let policy =
OrgPolicy::new(org_id, OrgPolicyType::MasterPassword, CONFIG.sso_master_password_policy().is_some(), data);
Ok(Json(policy.to_json()))
}

Datei anzeigen

@ -807,7 +807,7 @@ impl Membership {
// Should be used only when email are disabled.
// In Organizations::send_invite status is set to Accepted only if the user has a password.
pub async fn confirm_user_invitations(user_uuid: &UserId, conn: &mut DbConn) -> EmptyResult {
pub async fn accept_user_invitations(user_uuid: &UserId, conn: &mut DbConn) -> EmptyResult {
db_run! { conn: {
diesel::update(users_organizations::table)
.filter(users_organizations::user_uuid.eq(user_uuid))
@ -1151,7 +1151,7 @@ impl OrganizationApiKey {
)]
#[deref(forward)]
#[from(forward)]
pub struct OrganizationId(pub String);
pub struct OrganizationId(String);
#[derive(
Clone,