Merge branch 'RED-7297-A' into 'main'

RED-7297: error message when resetting password

See merge request fforesight/tenant-user-management-service!14
This commit is contained in:
Ali Oezyetimoglu 2023-08-28 16:52:17 +02:00
commit b2bc62694c

View File

@ -132,7 +132,7 @@ public class UserService {
try {
this.getTenantUsersResource().get(userId).executeActionsEmail(Collections.singletonList("UPDATE_PASSWORD"), 86400);
} catch (Exception e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Failed to send email", e);
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Failed to send email.", e);
}
}
@ -445,12 +445,12 @@ public class UserService {
try {
CredentialRepresentation request = new CredentialRepresentation();
request.setType("password");
request.setType(CredentialRepresentation.PASSWORD);
request.setTemporary(resetPasswordRequest.isTemporary());
request.setValue(resetPasswordRequest.getPassword());
realmService.realm(TenantContext.getTenantId()).users().get(userId).resetPassword(request);
} catch (Exception e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Failed to send email", e);
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Could not reset password. Please check your input.", e);
}
}