示例#1
0
        public ActionResult Index(LoginModel item)
        {
            if (ModelState.IsValid)
            {
                var sysUser = _sysUserService.GetByUserNamePassword(item.EnterpriseId, item.UserName, item.Password);

                if (sysUser != null)
                {
                    if (sysUser.Enabled)
                    {
                        FormsAuthentication.RedirectFromLoginPage(sysUser.EnterpriseId + "," + sysUser.Id, item.Remember);
                    }
                    else
                    {
                        ModelState.AddModelError("", lang.UserDisabled);
                    }
                }
                else
                {
                    ModelState.AddModelError("", lang.UserNamePasswordError);
                }
            }
            Index();
            return View(item);
        }
示例#2
0
        public ActionResult Index(LoginModel item)
        {
            var sysUser = _sysUserService.GetByUserNamePassword(item.EnterpriseId, item.UserName, item.Password);

            if (sysUser != null)
            {
                if (sysUser.Enabled)
                {
                    FormsAuthentication.SetAuthCookie("" + sysUser.Id, item.Remember);
                    return Redirect(FormsAuthentication.DefaultUrl);
                }
                TempData[Alerts.Warning] = lang.UserDisabled;
            }
            else
            {
                TempData[Alerts.Warning] = lang.UserNamePasswordError;
            }

            return RedirectToAction("Index");
        }