Use JWT to validate existing user invites

This commit is contained in:
Nick Fox 2018-12-23 15:15:44 -05:00
parent 2b24b17609
commit b0ac640d8b
No known key found for this signature in database
GPG Key ID: 82719985805A7CA8
1 changed files with 10 additions and 13 deletions

View File

@ -532,7 +532,7 @@ 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) {
@ -544,9 +544,6 @@ fn accept_invite(_org_id: String, _org_user_id: String, data: JsonUpcase<AcceptD
err!("Failed to accept user to organization") err!("Failed to accept user to organization")
} }
} }
} else {
err!("Invitation for user not found")
}
}, },
None => { None => {
err!("Invited user not found") err!("Invited user not found")