Ejemplo n.º 1
0
        public JsonResult Signin(LoginModel model)
        {
            if (WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                return Json(new { Success = true, Message = "" });
            }

            return Json(new { Success = false, Message = Global.UsernameAndPassowrdIncorrect }); ;
        }
Ejemplo n.º 2
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                if (string.IsNullOrEmpty(returnUrl))
                    return Redirect("/");
                return Redirect(returnUrl);
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", Global.UsernameAndPassowrdIncorrect);

            return View(model);
        }