Search in sources :

Example 1 with Mail

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";
}
Also used : Mail(ua.springweb.security.mail.Mail) UserEntity(ua.springweb.security.entity.UserEntity) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

PostMapping (org.springframework.web.bind.annotation.PostMapping)1 UserEntity (ua.springweb.security.entity.UserEntity)1 Mail (ua.springweb.security.mail.Mail)1