Ejemplo n.º 1
0
        public async Task <IActionResult> Login(string user_email, string password)
        {
            Console.WriteLine(user_email);
            var userToVerify = await UserMgr.FindByEmailAsync(user_email);

            var result = await SignInMgr.PasswordSignInAsync(userToVerify.UserName, password, true, false);

            Console.WriteLine(result.Succeeded);
            if (result.Succeeded)
            {
                var identity = await UserMgr.GetClaimsAsync(userToVerify);

                var userToSend = new UserModel();
                userToSend.FirstName = userToVerify.FirstName;
                userToSend.LastName  = userToVerify.LastName;
                userToSend.UserName  = userToVerify.NormalizedEmail.ToLower();
                userToSend.Email     = userToVerify.NormalizedEmail.ToLower();
                Console.WriteLine(userToSend + "<-----");
                return(Ok(userToSend));
            }

            return(Ok(user_email));
        }