|
30 | 30 | import org.springframework.security.core.userdetails.UserDetailsService; |
31 | 31 | import org.springframework.stereotype.Controller; |
32 | 32 | import org.springframework.ui.Model; |
33 | | -import org.springframework.validation.BindingResult; |
34 | 33 | import org.springframework.validation.Errors; |
35 | 34 | import org.springframework.web.bind.annotation.ModelAttribute; |
36 | 35 | import org.springframework.web.bind.annotation.RequestMapping; |
@@ -102,25 +101,22 @@ public String confirmRegistration(final HttpServletRequest request, final Model |
102 | 101 | } |
103 | 102 |
|
104 | 103 | @RequestMapping(value = "/user/registration", method = RequestMethod.POST) |
105 | | - public ModelAndView registerUserAccount(@ModelAttribute("user") @Valid final UserDto accountDto, final BindingResult result, final HttpServletRequest request, final Errors errors) { |
106 | | - LOGGER.debug("Registering user account with information: {}", accountDto); |
107 | | - if (result.hasErrors()) { |
108 | | - return new ModelAndView("registration", "user", accountDto); |
109 | | - } |
| 104 | + public ModelAndView registerUserAccount(@ModelAttribute("user") @Valid final UserDto userDto, final HttpServletRequest request, final Errors errors) { |
| 105 | + LOGGER.debug("Registering user account with information: {}", userDto); |
110 | 106 |
|
111 | | - final User registered = createUserAccount(accountDto); |
| 107 | + final User registered = createUserAccount(userDto); |
112 | 108 | if (registered == null) { |
113 | | - result.rejectValue("email", "message.regError"); |
114 | | - return new ModelAndView("registration", "user", accountDto); |
| 109 | + // result.rejectValue("email", "message.regError"); |
| 110 | + return new ModelAndView("registration", "user", userDto); |
115 | 111 | } |
116 | 112 | try { |
117 | 113 | final String appUrl = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); |
118 | 114 | eventPublisher.publishEvent(new OnRegistrationCompleteEvent(registered, request.getLocale(), appUrl)); |
119 | 115 | } catch (final Exception ex) { |
120 | 116 | LOGGER.warn("Unable to register user", ex); |
121 | | - return new ModelAndView("emailError", "user", accountDto); |
| 117 | + return new ModelAndView("emailError", "user", userDto); |
122 | 118 | } |
123 | | - return new ModelAndView("successRegister", "user", accountDto); |
| 119 | + return new ModelAndView("successRegister", "user", userDto); |
124 | 120 | } |
125 | 121 |
|
126 | 122 | @RequestMapping(value = "/user/resendRegistrationToken", method = RequestMethod.GET) |
|
0 commit comments