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 authored and marwanehcine committed Jan 8, 2024
1 parent 81a7d30 commit fe3924f
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -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) {
// beans getting a reference to the sender
public void sendNewOAuthAccountMessage(String fullName, 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("username", fullName);
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 fe3924f

Please sign in to comment.