Ejemplo n.º 1
0
 @RequestMapping("/login-action")
 @ResponseBody
 public ViewCommandObject loginAction(
     @ModelAttribute("passportForm") PassportForm passportForm,
     ModelMap modelMap,
     HttpServletRequest servletRequest,
     HttpServletResponse servletResponse) {
   try {
     authServiceMgr.login(passportForm.getAdminName(), passportForm.getAdminPwd(), servletRequest);
   } catch (AdminException e) {
     ViewCommandObject object = ViewCommandHelper.createErrorObject();
     if (e.getErrorCode().equals(ErrorCode.Admin_Hasbeen_Forbit)) {
       object.setMessage("当前账户已被禁用,请联系管理员开通");
     } else if (e.getErrorCode().equals(ErrorCode.AdminName_Not_Found)) {
       object.setMessage("账户名不存在,请检查");
     } else if (e.getErrorCode().equals(ErrorCode.AdminName_Password_Not_Match)) {
       object.setMessage("账户名密码不匹配,请检查");
     }
     return object;
   }
   ViewCommandObject object = ViewCommandHelper.createSuccessObject();
   object.addParam("redirectUrl", "/index.jhtml");
   return object;
 }
Ejemplo n.º 2
0
 @RequestMapping("/logout")
 public String logout(HttpServletRequest servletRequest, HttpServletResponse servletResponse) {
   authServiceMgr.logout(servletRequest);
   return "redirect:/login.jhtml";
 }