public ActionResult LoginAjax(string userName, string password)
        {
            var user = UserDatabase.Users.Where(o => string.Compare(o.Name, userName, StringComparison.InvariantCultureIgnoreCase) == 0).SingleOrDefault();
            if (user == null)
            {
                return Json(new { result = "fail" });
            }

            if (!user.CheckPassword(password))
            {
                return Json(new { result = "fail" });
            }

            _currentUser = user;

            if (user.TwoFactorAuthEnabled)
            {
                return Json(new { result = "twostep" });
            }

            return Json(new { result = "success" });
        }
 public ActionResult Logout()
 {
     _currentUser = null;
     return RedirectToAction("Index");
 }