3939
4040@ Controller
4141public class RegistrationController {
42-
4342 private final Logger LOGGER = LoggerFactory .getLogger (getClass ());
4443
4544 @ Autowired
@@ -111,7 +110,8 @@ public ModelAndView registerUserAccount(@ModelAttribute("user") @Valid final Use
111110 try {
112111 final String appUrl = request .getContextPath ();
113112 eventPublisher .publishEvent (new OnRegistrationCompleteEvent (registered , request .getLocale (), appUrl ));
114- } catch (final Exception me ) {
113+ } catch (final Exception ex ) {
114+ LOGGER .warn ("Unable to register user" , ex );
115115 return new ModelAndView ("emailError" , "user" , accountDto );
116116 }
117117 return new ModelAndView ("successRegister" , "user" , accountDto );
@@ -126,10 +126,10 @@ public String resendRegistrationToken(final WebRequest request, final Model mode
126126 final SimpleMailMessage email = constructResetVerificationTokenEmail (request .getContextPath (), request .getLocale (), newToken , user );
127127 mailSender .send (email );
128128 } catch (final MailAuthenticationException e ) {
129- LOGGER .debug ("MailAuthenticationException" );
129+ LOGGER .debug ("MailAuthenticationException" , e );
130130 return "redirect:/emailError.html?lang=" + locale .getLanguage ();
131131 } catch (final Exception e ) {
132- LOGGER .debug (e .getLocalizedMessage ());
132+ LOGGER .debug (e .getLocalizedMessage (), e );
133133 model .addAttribute ("message" , e .getLocalizedMessage ());
134134 return "redirect:/login.html?lang=" + locale .getLanguage ();
135135 }
@@ -149,13 +149,14 @@ public String resetPassword(final WebRequest request, final Model model, @Reques
149149 userService .createPasswordResetTokenForUser (user , token );
150150 try {
151151 final SimpleMailMessage email = constructResetTokenEmail (request .getContextPath (), request .getLocale (), token , user );
152+
152153 LOGGER .debug (email .getText ());
153154 mailSender .send (email );
154155 } catch (final MailAuthenticationException e ) {
155- LOGGER .debug ("MailAuthenticationException" );
156+ LOGGER .debug ("MailAuthenticationException" , e );
156157 return "redirect:/emailError.html?lang=" + request .getLocale ().getLanguage ();
157158 } catch (final Exception e ) {
158- LOGGER .debug (e .getLocalizedMessage ());
159+ LOGGER .debug (e .getLocalizedMessage (), e );
159160 model .addAttribute ("message" , e .getLocalizedMessage ());
160161 return "redirect:/login.html?lang=" + request .getLocale ().getLanguage ();
161162 }
@@ -206,7 +207,6 @@ private final SimpleMailMessage constructResetVerificationTokenEmail(final Strin
206207 final SimpleMailMessage email = new SimpleMailMessage ();
207208 email .setSubject ("Resend Registration Token" );
208209 email .setText (message + " \r \n " + "http://localhost:8080" + confirmationUrl );
209-
210210 email .setTo (user .getEmail ());
211211 return email ;
212212 }
0 commit comments