use of me.zbl.fullstack.entity.User in project FS-Blog by JamesZBL.
the class UserController method fFrontUserLogin.
/**
* 前台用户登录
* 表单提交
*/
@PostMapping("/userlogin.f")
public String fFrontUserLogin(HttpServletRequest request, Model model, @Valid UserLoginForm loginForm, BindingResult bindingResult) throws Exception {
if (bindingResult.hasErrors()) {
List<ObjectError> errors = bindingResult.getAllErrors();
addModelAtt(model, VIEW_MSG, errors.get(0).getDefaultMessage());
return "userlogin";
}
User user = mUserService.loginAuthentication(loginForm);
if (null != user) {
mUserService.joinSession(request, user);
return "redirect:/";
}
addModelAtt(model, VIEW_MSG, "用户名或密码错误");
return "userlogin";
}
Aggregations