Feature #19708 invite common library should send a temporary password

This commit is contained in:
Massimiliano Assante 2020-07-23 10:38:50 +02:00
parent fd69234e0b
commit 98e4218111
1 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,7 @@ public class InvitesManager {
GCubeUser currUser = PortalContext.getConfiguration().getCurrentUser(request);
String username = currUser.getUsername();
String fromFullName = currUser.getFullname();
String controlcode = UUID.randomUUID().toString();
String controlcode = GenerateSecurePassword.generatePassword(RANDOM_PASSWD_LENGTH);
String currScope = PortalContext.getConfiguration().getCurrentScope(request);
Invite invite = new Invite(UUID.randomUUID().toString(), username, currScope, email, controlcode, InviteStatus.PENDING, new Date(), fromFullName);
@ -152,7 +152,7 @@ public class InvitesManager {
.append("?")
.append(getParamsEncoded);
String randomPasswd = "";
if (accountExists) {
EmailTemplateService.send(
subject,
@ -161,10 +161,10 @@ public class InvitesManager {
new Recipient(email), new Recipient(new EmailAddress(currUser.getEmail()), RecipientType.CC));
}
else { //the user account does not exists yet, it needs to be created on KC and a random pwd to be sent to the user in the email
randomPasswd = GenerateSecurePassword.generatePassword(RANDOM_PASSWD_LENGTH);
EmailTemplateService.send(
subject,
new TemplatenviteWIthPassword(gatewayName, gatewayURL, currUser, name, vreName, vreDescription, linkToAcceptInvite.toString(), randomPasswd),
new TemplatenviteWIthPassword(gatewayName, gatewayURL, currUser, name, vreName, vreDescription, linkToAcceptInvite.toString(), invite.getControlCode()),
request,
new Recipient(email), new Recipient(new EmailAddress(currUser.getEmail()), RecipientType.CC));
}