Beispiel #1
0
 @RequestMapping(value = "/next_step", method = RequestMethod.POST)
 public String post_next_step(
     @RequestParam Map<String, String> values, User user, ModelMap model) {
   Map<String, String> errors = userService.validate(values);
   if (errors.isEmpty()) {
     Steps next = userService.getUserStep().next();
     userService.setUserStep(next);
     user.setStep(next);
     userService.mergeUser(user);
   } else {
     model.addAttribute("errors", errors);
   }
   model.addAttribute("user", user);
   return userService.getUserStep().toString();
 }
Beispiel #2
0
 @RequestMapping(value = "/finale", method = RequestMethod.POST)
 public String finale(@RequestParam Map<String, String> values, User user, ModelMap model) {
   Map<String, String> errors = userService.validate(values);
   if (!errors.isEmpty()) {
     model.addAttribute("user", user);
     model.addAttribute("errors", errors);
     return userService.getUserStep().toString();
   }
   user.setStep(Steps.finale);
   userService.mergeUser(user);
   Authentication auth =
       new UsernamePasswordAuthenticationToken(
           userService.loadUserByUsername(userService.getCurrentUser().getEmail()),
           new SimpleGrantedAuthority("ROLE_USER"));
   SecurityContextHolder.getContext().setAuthentication(auth);
   userService.userDone();
   return "redirect:/step/finale.kitty";
 }