Skip to content

Commit

Permalink
Merge pull request #91 from georchestra/updated_oauth2_and_org_fields…
Browse files Browse the repository at this point in the history
…_in_creation_emails

Updated OAuth2 provider and organization fields in account creation e-mails
  • Loading branch information
emmdurin authored Jan 18, 2024
2 parents 47771de + a775118 commit 8f41787
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Empty file added AI_tests/test.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@ public void on(AccountCreated event) {
final String oAuth2ProviderId = user.getOAuth2ProviderId();
if (null != oAuth2ProviderId) {
String fullName = user.getFirstName() + " " + user.getLastName();
String localUid = user.getUsername();
String email = user.getEmail();
String provider = oAuth2ProviderId;
sendNewOAuthAccountMessage(fullName, email, provider);
String organization = user.getOrganization();
String[] providerFields = oAuth2ProviderId.split(";");
String providerName = "";
String providerUid = "";
if(providerFields.length == 2)
{
providerName = providerFields[0];
providerUid = providerFields[1];
}
sendNewOAuthAccountMessage(fullName, localUid, email, organization, providerName, providerUid);
}
}

public void sendNewOAuthAccountMessage(String fullName, String email, String provider) {
// beans getting a reference to the sender
public void sendNewOAuthAccountMessage(String fullName, String localUid, String email, String organization,
String providerName, String providerUid) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("uid", UUID.randomUUID());
jsonObj.put("subject", OAUTH2_ACCOUNT_CREATION);
jsonObj.put("username", fullName); // bean
jsonObj.put("email", email); // bean
jsonObj.put("provider", provider); // bean
jsonObj.put("fullName", fullName);
jsonObj.put("localUid", localUid);
jsonObj.put("email", email);
jsonObj.put("organization", organization);
jsonObj.put("providerName", providerName);
jsonObj.put("providerUid", providerUid);
eventTemplate.convertAndSend("routing-gateway", jsonObj.toString());// send
}
}

0 comments on commit 8f41787

Please sign in to comment.