Esempio n. 1
0
        public async Task <ActionResult> Post([FromBody] LoginRequestViewModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Username) || string.IsNullOrWhiteSpace(model.Password))
            {
                return(new UnauthorizedResult());
            }

            MemberModel member = await _userManager.FindByNameAsync(model.Username);

            if (member != null)
            {
                SignInResult result = await _signInManager.CheckPasswordSignInAsync(member, model.Password, false);

                if (result.Succeeded)
                {
                    // await _signInManager.SignInAsync(member, false);

                    await _memberServices.SendTwoFactorCodeAsync(member);

                    return(new OkResult());
                }
            }
            return(new UnauthorizedResult());
        }