public ActionResult LoginAjax(UserLoginViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (_userTasks.Login(model.Username, model.Password, model.LogMeIn))
         {
             return Content("Awesome! You are now logged in.");
         }
     }
     //TODO: Return a partial view instead of inline html
     return Content("<strong>Login failed!</strong><br/> Please verify your username and password.");
 }
        public ActionResult Login(UserLoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (_userTasks.Login(model.Username, model.Password, model.LogMeIn))
                {
                    //don't use formsAuth.Redirect as it sets the cookie again and will screw things up
                    //down the road

                    string returnUrl = _httpContextProvider.Request.QueryString[Constants.RETURN_URL];
                    if (string.IsNullOrWhiteSpace(returnUrl))
                    {
                        return Redirect(FormsAuthentication.DefaultUrl);
                    }
                    else
                    {
                        return Redirect(returnUrl);
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Invalid credentials");
                }
            }

            return View();
        }