Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-12-01 06:31:11 +01:00
Use JWT to validate existing user invites
Dieser Commit ist enthalten in:
Ursprung
2b24b17609
Commit
b0ac640d8b
1 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen
|
@ -532,20 +532,17 @@ fn accept_invite(_org_id: String, _org_user_id: String, data: JsonUpcase<AcceptD
|
||||||
|
|
||||||
match User::find_by_mail(&claims.email, &conn) {
|
match User::find_by_mail(&claims.email, &conn) {
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
if Invitation::take(&claims.email, &conn) {
|
Invitation::take(&claims.email, &conn);
|
||||||
if claims.user_org_id.is_some() {
|
if claims.user_org_id.is_some() {
|
||||||
// If this isn't the virtual_org, mark userorg as accepted
|
// If this isn't the virtual_org, mark userorg as accepted
|
||||||
let mut user_org = match UserOrganization::find_by_uuid_and_org(&claims.user_org_id.unwrap(), &claims.org_id, &conn) {
|
let mut user_org = match UserOrganization::find_by_uuid_and_org(&claims.user_org_id.unwrap(), &claims.org_id, &conn) {
|
||||||
Some(user_org) => user_org,
|
Some(user_org) => user_org,
|
||||||
None => err!("Error accepting the invitation")
|
None => err!("Error accepting the invitation")
|
||||||
};
|
};
|
||||||
user_org.status = UserOrgStatus::Accepted as i32;
|
user_org.status = UserOrgStatus::Accepted as i32;
|
||||||
if user_org.save(&conn).is_err() {
|
if user_org.save(&conn).is_err() {
|
||||||
err!("Failed to accept user to organization")
|
err!("Failed to accept user to organization")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
err!("Invitation for user not found")
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
|
|
Laden …
In neuem Issue referenzieren