cleanup work

This commit is contained in:
eugenp 2015-02-15 19:54:51 +02:00
parent 52e4ea940d
commit 308222fdbf
3 changed files with 29 additions and 4 deletions

View File

@ -0,0 +1,23 @@
package org.baeldung.web.controller;
public class GenericResponse {
private String message;
public GenericResponse() {
super();
}
public GenericResponse(final String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -151,13 +151,14 @@ public class RegistrationController {
}
@RequestMapping(value = "/user/resendRegistrationToken2", method = RequestMethod.GET)
public @ResponseBody String resendRegistrationToken2(final HttpServletRequest request, final Model model, @RequestParam("token") final String existingToken) throws JsonProcessingException, NoSuchMessageException {
public @ResponseBody GenericResponse resendRegistrationToken2(final HttpServletRequest request, @RequestParam("token") final String existingToken) {
final VerificationToken newToken = userService.generateNewVerificationToken(existingToken);
final User user = userService.getUser(newToken.getToken());
final String appUrl = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
final SimpleMailMessage email = constructResetVerificationTokenEmail(appUrl, request.getLocale(), newToken, user);
mailSender.send(email);
return new ObjectMapper().writeValueAsString(messages.getMessage("message.resendToken", null, request.getLocale()));
return new GenericResponse(messages.getMessage("message.resendToken", null, request.getLocale()));
}
@RequestMapping(value = "/user/resetPassword", method = RequestMethod.POST)
@ -187,9 +188,10 @@ public class RegistrationController {
}
@RequestMapping(value = "/user/resetPassword2", method = RequestMethod.POST)
public @ResponseBody String resetPassword2(final HttpServletRequest request, final Model model, @RequestParam("email") final String userEmail) throws JsonProcessingException, NoSuchMessageException {
public @ResponseBody String resetPassword2(final HttpServletRequest request, @RequestParam("email") final String userEmail) throws JsonProcessingException, NoSuchMessageException {
final User user = userService.findUserByEmail(userEmail);
if (user == null) {
// throw new NotFoundExceptions(messages.getMessage("message.userNotFound", null, request.getLocale())); // 404
return new ObjectMapper().writeValueAsString(messages.getMessage("message.userNotFound", null, request.getLocale()));
}

View File

@ -8,7 +8,7 @@ public class SessionListener implements HttpSessionListener {
@Override
public void sessionCreated(HttpSessionEvent event) {
System.out.println("==== Session is created ====");
event.getSession().setMaxInactiveInterval(1 * 60);
event.getSession().setMaxInactiveInterval(30 * 60);
}
@Override