use of ua.springweb.security.mail.Mail in project Logos_Materials_October_2017 by VolodymyrZavada.
the class BaseController method saveUser.
@PostMapping("/register")
public String saveUser(@ModelAttribute("registerModel") RegisterRequest request) {
UserEntity user = UserMapper.registerToUser(request);
String token = RandomToken.generateRandom();
user.setToken(token);
user.setActivated(false);
userService.saveUser(user);
Mail mail = new Mail();
mail.setTo(request.getEmail());
mail.setSubject("You are successfully registered");
mail.setContent("Please verify your email address by follow the link: " + "http://localhost:8090/verify?token=" + token + "&userid=" + user.getId());
emailService.sendMessage(mail);
return "redirect:/login";
}
Aggregations