public ActionResult LogOn(Models.LogOnModel data)
        {
            try
            {
                if (data.UserName.Contains("@"))
                {
                    if ((data.UserName = MembershipService.GetUserNameByEmail(data.UserName)) == null)
                    {
                        ModelState.AddModelError("", "用户名 或 密码不正确");

                        Response.StatusCode = 406;
                        return(null);
                    }
                }

                if (MembershipService.ValidateUser(data.UserName, data.Password))
                {
                    FormsService.SignIn(data.UserName, data.RememberMe);

                    Response.StatusCode = 200;
                    return(null);
                }
                else
                {
                    ModelState.AddModelError("", "用户名 或 密码不正确");
                }

                Response.StatusCode = 406;
                return(null);
            }
            catch
            {
                Response.StatusCode = 500;
                return(null);
            }
        }
Beispiel #2
0
 public ActionResult logOn()
 {
     DemoVS4.Models.LogOnModel LM = new Models.LogOnModel();
     return(PartialView("LogOn", LM));
 }
Beispiel #3
0
 public ActionResult logOn()
 {
     DemoVS4.Models.LogOnModel LM = new Models.LogOnModel();
     return PartialView("LogOn", LM);
 }