Missed 3 methods in previous commit. Needs heavy refactoring..

This commit is contained in:
Konstantinos Spyrou 2023-01-30 20:04:11 +02:00
parent 287f476bd2
commit 699b45d62f
1 changed files with 18 additions and 3 deletions

View File

@ -580,7 +580,12 @@ public class EmailUtilsImpl implements EmailUtils {
"If you have any questions, write to 'helpdesk@openaire.eu'.";
message = createUserMail(message, authentication);
this.sendMail(issuer, subject, message);
Collection<String> emailTo = new HashSet<>();
if (repository.getRegisteredby() != null) {
emailTo.add(repository.getRegisteredby());
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
@ -660,7 +665,12 @@ public class EmailUtilsImpl implements EmailUtils {
"If you have any questions, write to 'helpdesk@openaire.eu'.";
message = createUserMail(message, authentication);
this.sendMail(repository.getRegisteredby(), subject, message);
Collection<String> emailTo = new HashSet<>();
if (repository.getRegisteredby() != null) {
emailTo.add(repository.getRegisteredby());
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
@ -720,7 +730,12 @@ public class EmailUtilsImpl implements EmailUtils {
"If you have any questions, write to 'helpdesk@openaire.eu'.";
message = createUserMail(message, authentication);
this.sendMail(repository.getRegisteredby(), subject, message);
Collection<String> emailTo = new HashSet<>();
if (repository.getRegisteredby() != null) {
emailTo.add(repository.getRegisteredby());
}
emailTo.add(User.from(((OIDCAuthenticationToken) authentication).getUserInfo()).getEmail());
this.sendMail(emailTo, subject, message);
} catch (Exception e) {
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);