public virtual async Task<ActionResult> Login(LoginModel model, string returnUrl)
        {
            if (!ModelState.IsValid) 
                return View(model);

            var user = await _userManager.FindAsync(model.Username, model.Password);
            if (user != null)
            {
                await SignInAsync(user, model.RememberMe);
                CreateAuthenticationTicket(user);
                return RedirectToLocal(returnUrl);
            }
                
            ModelState.AddModelError("", "Invalid username or password.");

            return View(model);
        }
Example #2
0
 public HomePage Login(LoginModel login)
 {
     return TopMenu.GoToLoginPage().Login(login);
 }