|
|
@ -43,7 +43,7 @@ import javax.servlet.http.*; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@org.springframework.stereotype.Controller |
|
|
|
@org.springframework.stereotype.Controller |
|
|
|
@RequestMapping("/passwordSettings") |
|
|
|
@RequestMapping("/passwordSettings") |
|
|
|
@SessionAttributes( value="command", types={PasswordSettingsCommand.class} ) |
|
|
|
//@SessionAttributes( value="command", types={PasswordSettingsCommand.class} )
|
|
|
|
public class PasswordSettingsController { |
|
|
|
public class PasswordSettingsController { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
@ -56,14 +56,6 @@ public class PasswordSettingsController { |
|
|
|
binder.addValidators(passwordSettingsValidator); |
|
|
|
binder.addValidators(passwordSettingsValidator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* @ModelAttribute |
|
|
|
|
|
|
|
protected Object formBackingObject(HttpServletRequest request) throws Exception { |
|
|
|
|
|
|
|
PasswordSettingsCommand command = new PasswordSettingsCommand(); |
|
|
|
|
|
|
|
User user = securityService.getCurrentUser(request); |
|
|
|
|
|
|
|
command.setUsername(user.getUsername()); |
|
|
|
|
|
|
|
command.setLdapAuthenticated(user.isLdapAuthenticated()); |
|
|
|
|
|
|
|
return command; |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
@RequestMapping(method = RequestMethod.GET) |
|
|
|
protected ModelAndView displayForm(HttpServletRequest request) throws Exception { |
|
|
|
protected ModelAndView displayForm(HttpServletRequest request) throws Exception { |
|
|
@ -75,14 +67,17 @@ public class PasswordSettingsController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.POST) |
|
|
|
@RequestMapping(method = RequestMethod.POST) |
|
|
|
protected String doSubmitAction(@ModelAttribute("command") @Validated PasswordSettingsCommand command) throws Exception { |
|
|
|
protected String doSubmitAction(HttpServletRequest request,@ModelAttribute("command") @Validated PasswordSettingsCommand command,BindingResult bindingResult) throws Exception { |
|
|
|
User user = securityService.getUserByName(command.getUsername()); |
|
|
|
if (!bindingResult.hasErrors()) { |
|
|
|
user.setPassword(command.getPassword()); |
|
|
|
User user = securityService.getUserByName(command.getUsername()); |
|
|
|
securityService.updateUser(user); |
|
|
|
user.setPassword(command.getPassword()); |
|
|
|
|
|
|
|
securityService.updateUser(user); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.setPassword(null); |
|
|
|
|
|
|
|
command.setConfirmPassword(null); |
|
|
|
|
|
|
|
request.setAttribute("settings_toast",true); |
|
|
|
|
|
|
|
|
|
|
|
command.setPassword(null); |
|
|
|
} |
|
|
|
command.setConfirmPassword(null); |
|
|
|
|
|
|
|
command.setToast(true); |
|
|
|
|
|
|
|
return "passwordSettings"; |
|
|
|
return "passwordSettings"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|