/// <summary> /// 作者:Primo /// 时间:2015.05.14 /// 描述:修改,教师和员工也可以使用一课一练做题 /// </summary> /// <param name="accountModel"></param> /// <returns></returns> public JsonResult Login(AccountModel accountModel) { var result = eWorkbook.Login(accountModel); if (!result.Status) { return Json(new { Error = "Authentication Failed" }, JsonRequestBehavior.AllowGet); } return Json(new { Name = result.ReturnValue.CName, Account = result.ReturnValue.UserName, Number = result.ReturnValue.StudentId, SiteId = result.ReturnValue.BranchParentId, CityId = result.ReturnValue.BranchId, ProductsStr = string.Join(",", result.ReturnValue.ProduntIds) }, JsonRequestBehavior.AllowGet); }
/// <summary> /// 作者:Primo /// 时间:2015.05.14 /// 描述:修改, userName以字符串形式进入 /// </summary> /// <param name="model"></param> /// <returns></returns> public FunctionResult<StudentInfo> Login(AccountModel model) { //判断学生 var resultTemp = UserBLL.UserLoginValidate(model.UserName, model.Password); var result = new FunctionResult<StudentInfo>() { Status = resultTemp.Status, Info = resultTemp.Info }; if (resultTemp.Status) { //判断该用户的用户类型是不是学生 if (resultTemp.UserType.ToString() == Enum.ConvertEnum.UserTypeForStudent.ToString()) result.ReturnValue = StudentBLL.GetStudentInfoByUserName(model.UserName); else//不是学生则可以拥有所有产品操作 { result.ReturnValue = UserBLL.GetEWorkBookUserInfoByUserName(model.UserName); result.ReturnValue.ProduntIds = new int[3] { 1, 2, 3 }; } } return result; }
public ActionResult Login(AccountModel model) { //验证账号、密码 var result = UserBLL.UserLoginValidate(model.UserName, SecurityHelper.GetMd5(model.Password), UserType.Employee); if (result.Status) { WebCommon.Cache.LoginUserCache.UpdateLoginUserCacheForLogin(result.ReturnValue.ToString()); var loginUser = WebCommon.Cache.LoginUserCache.GetLoginUserCacheByKey(result.ReturnValue.ToString()); if (loginUser == null) { ViewBag.Tiper = new FunctionResult() { Status = false, Info = "登录异常,请与管理员联系!", ReturnValue = null }; return View(model); } LoginUserManager.SignLoginUser(loginUser); return RedirectToAction("Index", "Home", new { Area = "" }); } ViewBag.Tiper = result; return View(model); }
public ActionResult Login(AccountModel model) { //2015.05.07 beta 修改. 去掉验证码 //if (ModelState.IsValid) //{ // if (Request.Cookies[WebCommon.Global.CheckCodeKey] != null) // { // if (!WebCommon.LoginUserManager.IsCheckCode(model.CheckCode)) // { // ViewBag.Tiper = new FunctionResult() // { // Status = false, // Info = "Verification code error!", // ReturnValue = null // }; // return View(model); // } // //验证码使用完后,清除。 // Request.Cookies[WebCommon.Global.CheckCodeKey].Expires = DateTime.Now.AddDays(-1); // } // else // { // ViewBag.Tiper = new FunctionResult() // { // Status = false, // Info = "Verification code has expired!", // ReturnValue = null // }; // return View(model); // } //验证账号、密码 var result = UserBLL.UserLoginValidate(model.UserName, Utility.SecurityHelper.GetMd5(model.Password), Enum.UserType.Teacher); if (result.Status) { WebCommon.Cache.LoginUserCache.UpdateLoginUserCacheForLogin(result.ReturnValue.ToString()); var loginUser = WebCommon.Cache.LoginUserCache.GetLoginUserCacheByKey(result.ReturnValue.ToString()); if (loginUser == null) { ViewBag.Tiper = new FunctionResult() { Status = false, Info = "Abnormal login, Please contact the administrator!", ReturnValue = null }; return View(model); } LoginUserManager.SignLoginUser(loginUser); return RedirectToAction("Index", "Home"); } ViewBag.Tiper = result; return View(model); }