How make for return post in my method authenticates.? I like to post to authenticate (method default in spring mvc for authenticate) and before add validate if user is active.
@RequestMapping(value = "/signin", method = RequestMethod.POST)
public ModelAndView authenticates(
@RequestParam("username") String login,
@RequestParam("password") String password,
@RequestParam("_spring_security_remember_me") String remember,
@RequestParam("_csrf") String csrf,
RedirectAttributes ra
) throws Exception {
ModelAndView model = new ModelAndView();
Account account = accountService.findByLogin(login);
if (!account.isActive()) {
MessageHelper.addErrorAttribute(ra, "signin.errorUserDown", login, login);
model.setViewName("redirect:/signin");
return model;
//return "redirect:/signin";
}
//userService.loadUserByUsername(login);
//userService.signin(account);
//model.addObject("submit");
model.addObject("username", login);
model.addObject("password", password);
model.addObject("_spring_security_remember_me", remember);
model.addObject("_csrf", csrf);
model.setViewName("signin/signinValidate");
return model;
//return "authenticate";
}
Aucun commentaire:
Enregistrer un commentaire