public IActionResult Login(User user) { var repository = new JokesRepository(_conn); User u = repository.GetUserByEmail(user.Email); if (u == null) { return(Redirect("/account/login")); } else if (!repository.Match(user.Password, u.Password)) { return(Redirect("/account/login")); } var claims = new List <Claim> { new Claim("user", user.Email) }; HttpContext.SignInAsync(new ClaimsPrincipal( new ClaimsIdentity(claims, "Cookies", "user", "role"))).Wait(); return(Redirect("/home/index")); }