diff --git a/spring-security-login-and-registration/pom.xml b/spring-security-login-and-registration/pom.xml index 24f0b374cc..2fad0252a3 100644 --- a/spring-security-login-and-registration/pom.xml +++ b/spring-security-login-and-registration/pom.xml @@ -54,17 +54,17 @@ - org.springframework - spring-test - test - + org.springframework + spring-test + test + - org.passay - passay - 1.0 - + org.passay + passay + 1.0 + @@ -137,6 +137,19 @@ test + + com.jayway.restassured + rest-assured + 2.4.0 + test + + + commons-logging + commons-logging + + + + @@ -189,4 +202,4 @@ 18.0 - + \ No newline at end of file diff --git a/spring-security-login-and-registration/src/main/java/org/baeldung/web/controller/RegistrationController.java b/spring-security-login-and-registration/src/main/java/org/baeldung/web/controller/RegistrationController.java index ab8d3feb66..f3520d052f 100644 --- a/spring-security-login-and-registration/src/main/java/org/baeldung/web/controller/RegistrationController.java +++ b/spring-security-login-and-registration/src/main/java/org/baeldung/web/controller/RegistrationController.java @@ -171,6 +171,7 @@ public class RegistrationController { // change user password @RequestMapping(value = "/user/updatePassword", method = RequestMethod.POST) + @PreAuthorize("hasRole('READ_PRIVILEGE')") @ResponseBody public GenericResponse changeUserPassword(final Locale locale, @RequestParam("password") final String password, @RequestParam("oldpassword") final String oldPassword) { final User user = userService.findUserByEmail(SecurityContextHolder.getContext().getAuthentication().getName()); diff --git a/spring-security-login-and-registration/src/main/webapp/WEB-INF/view/changePassword.jsp b/spring-security-login-and-registration/src/main/webapp/WEB-INF/view/changePassword.jsp index 21f4e52c23..dd4a28df66 100644 --- a/spring-security-login-and-registration/src/main/webapp/WEB-INF/view/changePassword.jsp +++ b/spring-security-login-and-registration/src/main/webapp/WEB-INF/view/changePassword.jsp @@ -13,6 +13,7 @@ <spring:message code="message.changePassword"></spring:message> +