Exemplo n.º 1
0
 public ViewResult SignIn(string returnUrl)
 {
     var signInModel = new AccountSignInViewModel
     {
         ReturnUrl = returnUrl
     };
     return View(signInModel);
 }
Exemplo n.º 2
0
        public ActionResult SignIn(AccountSignInViewModel signInModel)
        {
            if (!ModelState.IsValid)
            {
                return View(signInModel);
            }

            var result = _applicationSignInManager.PasswordSignInAsync(signInModel.UserName, signInModel.Password, signInModel.RememberMe, shouldLockout: false).Result;
            if (result == SignInStatus.Success)
            {
                return RedirectToLocal(signInModel.ReturnUrl);
            }
            else
            {
                ModelState.AddModelError(String.Empty, _resourceStringProvider.Get(AccountKeysConst.SignInError));
                return View(signInModel);
            }
        }