public ActionResult Login() { string userName = Request["UserName"]; string userPwd = Request["UserPwd"]; string keepalive = Request["keepalive"]; string verifyCode = Request["VerifyCode"]; if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(userPwd)) { throw new BusinessException("请输入账号或密码"); } if (string.IsNullOrWhiteSpace(verifyCode)) { throw new BusinessException("请输入验证码"); } string encrptedPassword = AuthMgr.EncryptPassword(userPwd); var user = AuthMgr.Login(userName, encrptedPassword, verifyCode, !string.IsNullOrEmpty(keepalive) && keepalive.ToLower() == "true"); if (user != null) { if (user.ExData != null && !user.ExData.ToString().Equals("0")) { var company = CompanyService.LoadCompany((int)user.ExData, false); if (company == null || company.CompanyStatus != Entity.CompanyStatus.Authenticated) { AuthMgr.Logout(); throw new BusinessException("您所在的公司还未认证!"); } if (company != null && company.AccountSysNo.HasValue && company.AccountSysNo.Value != user.UserSysNo) { AuthMgr.Logout(); throw new BusinessException("您没有权限登录此系统!"); } } } // SystemUserService systemUserServic = new SystemUserService(); // var loginUser= systemUserServic.LoadSystemUserBySysNo(user.UserSysNo, Entity.ConstValue.ApplicationID); // if (loginUser != null) // { // user.ExData = loginUser.MasterSysNo; //CookieHelper.SaveCookie<AuthUserModel>(LOGIN_COOKIE, user, 7 * 24 * 60); // } //} AjaxResult result = new AjaxResult { Success = true }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult DoLogin(string account,string password,string keepalive) { string encrptedPassword = AuthMgr.EncryptPassword(password); AuthMgr.Login(account, encrptedPassword, "6666", !string.IsNullOrEmpty(keepalive) && keepalive.ToLower() == "true"); return Json(new AjaxResult { Success = true, Message = "登录成功" }, JsonRequestBehavior.AllowGet); }