Exemplo n.º 1
0
        public ActionResult Login(LoginView account)
        {
            var req = Request.Url;
            if (ModelState.IsValid)
            {
                account.requester = "test_site";
                var at = DataBase.Security.GetAccessToken(account);
                if (at == "denied" || at == "error")
                    ModelState.AddModelError("fields", GlobalRes.LoginError);
                else
                {
                    //Разобраться с "запомнить" кнопкой
                    var cook = new HttpCookie("access_token", at);
                    Response.SetCookie(cook);

                    return new RedirectResult("Manage");
                }
            }
            return View("Login", account);
        }
Exemplo n.º 2
0
        public ActionResult LoginPartial(LoginView loginView)
        {
            if (ModelState.IsValid)
            {
                loginView.requester = "";
                var at = DataBase.Security.GetAccessToken(loginView);
                if (at == "denied" || at == "error")
                    ModelState.AddModelError("fields", "ошибка пароля");
                else
                {
                    Response.SetCookie(new HttpCookie("access_token", at));

                    return View("Reload");
                }
            }
            return View("~/Views/Account/Partial/Login.cshtml", loginView);
        }
Exemplo n.º 3
0
 public ActionResult Login()
 {
     LoginView account = new LoginView();
     return View("Login", account);
 }