Skip to content

Commit

Permalink
Splitted OAuth2 provider field and added organization for account cre…
Browse files Browse the repository at this point in the history
…ation emails
  • Loading branch information
emmdurin committed Jan 2, 2024
1 parent 81a7d30 commit 42f41fa
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ public void on(AccountCreated event) {
if (null != oAuth2ProviderId) {
String fullName = user.getFirstName() + " " + user.getLastName();
String email = user.getEmail();
String provider = oAuth2ProviderId;
sendNewOAuthAccountMessage(fullName, email, provider);
String organization = user.getOrganization();
String[] providerFields = oAuth2ProviderId.split(";");
sendNewOAuthAccountMessage(fullName, email, organization, providerFields[0], providerFields[1]);
}
}

public void sendNewOAuthAccountMessage(String fullName, String email, String provider) {
public void sendNewOAuthAccountMessage(String fullName, String email, String organization, String providerName, String providerUid) {
// beans getting a reference to the sender
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("organization", organization); // bean
jsonObj.put("providerName", providerName);
jsonObj.put("providerUid", providerUid);
eventTemplate.convertAndSend("routing-gateway", jsonObj.toString());// send
}
}

0 comments on commit 42f41fa

Please sign in to comment.