method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<?> registerAccount(@RequestBody UserDTO userDTO, HttpServletRequest request,
HttpServletResponse response) {
User user = userRepository.findOne(userDTO.getLogin());
if (user != null) {
return new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
} else {
user = userService.createUserInformation(userDTO.getLogin(), userDTO.getPassword(), userDTO.getFirstName(),
userDTO.getLastName(), userDTO.getEmail().toLowerCase(), userDTO.getLangKey());
final Locale locale = Locale.forLanguageTag(user.getLangKey());
String content = createHtmlContentFromTemplate(user, locale, request, response);
mailService.sendActivationEmail(user.getEmail(), content, locale);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}