From 0ba88a4c4920b2654be83bf3853928b95d360f8f Mon Sep 17 00:00:00 2001 From: Mariela Bonilla Date: Fri, 16 Jul 2021 04:53:08 -0600 Subject: [PATCH] =?UTF-8?q?Add=20Email=20para=20despues=20de=20restablecer?= =?UTF-8?q?=20contrase=C3=B1a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/datasurvey/service/MailService.java | 6 + .../datasurvey/web/rest/AccountResource.java | 3 + .../templates/mail/passwordRestoredEmail.html | 329 ++++++++++++++++++ 3 files changed, 338 insertions(+) create mode 100644 src/main/resources/templates/mail/passwordRestoredEmail.html diff --git a/src/main/java/org/datasurvey/service/MailService.java b/src/main/java/org/datasurvey/service/MailService.java index 0575e3d..c40c4fe 100644 --- a/src/main/java/org/datasurvey/service/MailService.java +++ b/src/main/java/org/datasurvey/service/MailService.java @@ -109,4 +109,10 @@ public class MailService { log.debug("Sending password reset email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); } + + @Async + public void sendPasswordRestoredMail(User user) { + log.debug("Sending password restored email to '{}'", user.getEmail()); + sendEmailFromTemplate(user, "mail/passwordRestoredEmail", "email.restored.title"); + } } diff --git a/src/main/java/org/datasurvey/web/rest/AccountResource.java b/src/main/java/org/datasurvey/web/rest/AccountResource.java index afb4a0c..6b830e9 100644 --- a/src/main/java/org/datasurvey/web/rest/AccountResource.java +++ b/src/main/java/org/datasurvey/web/rest/AccountResource.java @@ -173,6 +173,7 @@ public class AccountResource { // Pretend the request has been successful to prevent checking which emails really exist // but log that an invalid attempt has been made log.warn("Password reset requested for non existing mail"); + throw new EmailNotExistException(); } } @@ -192,6 +193,8 @@ public class AccountResource { if (!user.isPresent()) { throw new AccountResourceException("No user was found for this reset key"); + } else { + mailService.sendPasswordRestoredMail(user.get()); } } diff --git a/src/main/resources/templates/mail/passwordRestoredEmail.html b/src/main/resources/templates/mail/passwordRestoredEmail.html new file mode 100644 index 0000000..e1c4082 --- /dev/null +++ b/src/main/resources/templates/mail/passwordRestoredEmail.html @@ -0,0 +1,329 @@ + + + + + + + + + + + JHipster password restored + + + + + + + +
+
+ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  +
+ +
+ +