mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-04-01 02:42:49 -05:00
check for admin invite
This commit is contained in:
parent
29f2b433f0
commit
9a8cd557fd
2 changed files with 14 additions and 10 deletions
|
@ -1148,6 +1148,10 @@ async fn accept_invite(
|
|||
Invitation::take(&claims.email, &mut conn).await;
|
||||
|
||||
if let (Some(member), Some(org)) = (&claims.member_id, &claims.org_id) {
|
||||
if **member == "00000000-0000-0000-0000-000000000000" {
|
||||
// exit early when the invitation was done via admin panel
|
||||
return Ok(());
|
||||
}
|
||||
let Some(mut member) = Membership::find_by_uuid_and_org(member, org, &mut conn).await else {
|
||||
err!("Error accepting the invitation")
|
||||
};
|
||||
|
|
20
src/mail.rs
20
src/mail.rs
|
@ -264,22 +264,22 @@ pub async fn send_invite(
|
|||
org_name: &str,
|
||||
invited_by_email: Option<String>,
|
||||
) -> EmptyResult {
|
||||
let claims = generate_invite_claims(
|
||||
user.uuid.clone(),
|
||||
user.email.clone(),
|
||||
org_id.clone(),
|
||||
member_id.clone(),
|
||||
invited_by_email,
|
||||
);
|
||||
let invite_token = encode_jwt(&claims);
|
||||
let org_id = match org_id {
|
||||
Some(ref org_id) => org_id.as_ref(),
|
||||
None => "_",
|
||||
None => "00000000-0000-0000-0000-000000000000",
|
||||
};
|
||||
let member_id = match member_id {
|
||||
Some(ref member_id) => member_id.as_ref(),
|
||||
None => "_",
|
||||
None => "00000000-0000-0000-0000-000000000000",
|
||||
};
|
||||
let claims = generate_invite_claims(
|
||||
user.uuid.clone(),
|
||||
user.email.clone(),
|
||||
Some(org_id.to_string().into()),
|
||||
Some(member_id.to_string().into()),
|
||||
invited_by_email,
|
||||
);
|
||||
let invite_token = encode_jwt(&claims);
|
||||
let mut query = url::Url::parse("https://query.builder").unwrap();
|
||||
{
|
||||
let mut query_params = query.query_pairs_mut();
|
||||
|
|
Loading…
Add table
Reference in a new issue