public async Task <ActionResult <LoginResponseViewModel> > Post([FromBody] SecondFactorRequestViewModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Username) || string.IsNullOrWhiteSpace(model.Password) || string.IsNullOrWhiteSpace(model.SecondFactorValue))
            {
                return(new UnauthorizedResult());
            }

            HRUser user = await _userManager.FindByNameAsync(model.Username);

            if (user != null)
            {
                Microsoft.AspNetCore.Identity.SignInResult result = await _signInManager.CheckPasswordSignInAsync(user, model.Password, false);

                if (result.Succeeded)
                {
                    if (_hrServices.ValidateTwoFactorCodeAsync(user, model.SecondFactorValue))
                    {
                        IList <string> roles = await _userManager.GetRolesAsync(user);

                        string role = "";
                        if (roles.Contains("Admin"))
                        {
                            role = "Admin";
                        }
                        else if (roles.Contains("User"))
                        {
                            role = "User";
                        }

                        JwtSecurityTokenHandler handler         = new JwtSecurityTokenHandler();
                        SymmetricSecurityKey    securityKey     = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration["JwtKey"]));
                        SecurityTokenDescriptor tokenDescriptor = new SecurityTokenDescriptor
                        {
                            Subject = new ClaimsIdentity(new Claim[]
                            {
                                new Claim(ClaimTypes.Name, user.Id.ToString()),
                                new Claim(ClaimTypes.Role, role)
                            }),
                            Expires            = DateTime.UtcNow.AddDays(7),
                            SigningCredentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256Signature),
                        };
                        SecurityToken          securityToken = handler.CreateToken(tokenDescriptor);
                        LoginResponseViewModel responseModel = new LoginResponseViewModel();
                        responseModel.Token = handler.WriteToken(securityToken);
                        return(new OkObjectResult(responseModel));
                    }
                }
            }
            return(new UnauthorizedResult());
        }