Exemplo n.º 1
0
        public IActionResult Login(string email, string password)
        {
            JokesRepository rep  = new JokesRepository(_connString);
            User            user = rep.Login(email, password);

            if (user == null)
            {
                return(Redirect("/account/login"));
            }

            var claims = new List <Claim>
            {
                new Claim("user", email)
            };

            HttpContext.SignInAsync(new ClaimsPrincipal(
                                        new ClaimsIdentity(claims, "Cookies", "user", "role"))).Wait();
            return(Redirect("/"));
        }