correctly display error message when email is not found during password recovery

This commit is contained in:
Athou
2015-02-22 07:18:55 +01:00
parent 0b42e00b29
commit 5c9e1406a1

View File

@@ -235,7 +235,7 @@ public class UserREST {
public ImmutableList<String> getErrors() { public ImmutableList<String> getErrors() {
return ImmutableList.of(e.getMessage()); return ImmutableList.of(e.getMessage());
} }
}).build(); }).type(MediaType.TEXT_PLAIN).build();
} }
} }
@@ -260,7 +260,7 @@ public class UserREST {
public Response sendPasswordReset(@Valid PasswordResetRequest req) { public Response sendPasswordReset(@Valid PasswordResetRequest req) {
User user = userDAO.findByEmail(req.getEmail()); User user = userDAO.findByEmail(req.getEmail());
if (user == null) { if (user == null) {
return Response.status(Status.PRECONDITION_FAILED).entity("Email not found.").build(); return Response.status(Status.PRECONDITION_FAILED).entity("Email not found.").type(MediaType.TEXT_PLAIN).build();
} }
try { try {
user.setRecoverPasswordToken(DigestUtils.sha1Hex(UUID.randomUUID().toString())); user.setRecoverPasswordToken(DigestUtils.sha1Hex(UUID.randomUUID().toString()));