diff --git a/package-lock.json b/package-lock.json
index f14e539..82ef242 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21199,7 +21199,7 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
"integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=",
- "deprecated": "The",
+ "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.",
"dev": true,
"engines": {
"node": ">=0.4.x"
diff --git a/src/main/java/org/datasurvey/repository/CategoriaRepository.java b/src/main/java/org/datasurvey/repository/CategoriaRepository.java
index 66368c1..6a4897c 100644
--- a/src/main/java/org/datasurvey/repository/CategoriaRepository.java
+++ b/src/main/java/org/datasurvey/repository/CategoriaRepository.java
@@ -1,7 +1,8 @@
package org.datasurvey.repository;
import org.datasurvey.domain.Categoria;
-import org.springframework.data.jpa.repository.*;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
/**
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/java/org/datasurvey/web/rest/errors/EmailNotExistException.java b/src/main/java/org/datasurvey/web/rest/errors/EmailNotExistException.java
new file mode 100644
index 0000000..d212473
--- /dev/null
+++ b/src/main/java/org/datasurvey/web/rest/errors/EmailNotExistException.java
@@ -0,0 +1,10 @@
+package org.datasurvey.web.rest.errors;
+
+public class EmailNotExistException extends BadRequestAlertException {
+
+ private static final long serialVersionUID = 1L;
+
+ public EmailNotExistException() {
+ super(ErrorConstants.EMAIL_NOT_EXISTS_TYPE, "Email not exists!", "userManagement", "emailnotexists");
+ }
+}
diff --git a/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java b/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java
index 20df98d..109466d 100644
--- a/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java
+++ b/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java
@@ -12,6 +12,7 @@ public final class ErrorConstants {
public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password");
public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used");
public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used");
+ public static final URI EMAIL_NOT_EXISTS_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-exists");
private ErrorConstants() {}
}
diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties
index a9f66d4..52b6575 100644
--- a/src/main/resources/i18n/messages.properties
+++ b/src/main/resources/i18n/messages.properties
@@ -19,3 +19,11 @@ email.reset.title=DataSurvey password reset
email.reset.greeting=Dear {0}
email.reset.text1=For your DataSurvey account a password reset was requested, please click on the URL below to reset it:
email.reset.text2=Regards,
+
+# Password Restored Mail
+email.restored.title=Your password was reset in DataSurvey
+email.restored.greeting=Hello, {0}!
+email.restored.text1=Your DataSurvey password has been successfully reset..
+email.restored.text2=Regards,
+email.restored.text3=If you did not make this change, please notify the following email immediately:
+email.restored.email=datasurvey@gmail.com
diff --git a/src/main/resources/i18n/messages_es.properties b/src/main/resources/i18n/messages_es.properties
index 48d7ea4..32233bb 100644
--- a/src/main/resources/i18n/messages_es.properties
+++ b/src/main/resources/i18n/messages_es.properties
@@ -6,7 +6,7 @@ error.message=Mensaje:
# Activation email
email.activation.title=Activación de DataSurvey
-email.activation.greeting=Estimado/a {0}
+email.activation.greeting=¡Hola, {0}!
email.activation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para activarla:
email.activation.text2=Saludos,
email.signature=Equipo de DataSurvey.
@@ -16,6 +16,15 @@ email.creation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga cli
# Reset email
email.reset.title=Reinicio de contraseña de DataSurvey
-email.reset.greeting=Estimado/a {0}
+email.reset.greeting=¡Hola, {0}!
email.reset.text1=Se ha solicitado el reinicio de la contraseña para su cuenta en DataSurvey. Por favor, haga clic en el siguiente enlace para reiniciarla:
email.reset.text2=Saludos,
+
+# Password Restored Mail
+email.restored.title=Se restaleció su contraseña en DataSurvey
+email.restored.greeting=¡Hola, {0}!
+email.restored.text1=Se ha restablecido correctamente su contraseña en DataSurvey.
+email.restored.text2=Saludos,
+email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo:
+email.restored.email=datasurvey@gmail.com
+
diff --git a/src/main/resources/templates/mail/activationEmail.html b/src/main/resources/templates/mail/activationEmail.html
index 0bb53a2..4daaa73 100644
--- a/src/main/resources/templates/mail/activationEmail.html
+++ b/src/main/resources/templates/mail/activationEmail.html
@@ -1,20 +1,327 @@