Exemple #1
0
        public async Task <IActionResult> EnableTwoFactorAuthentication()
        {
            var user = await GetCurrentUserAsync();

            if (user != null)
            {
                await _userManager.SetTwoFactorEnabledAsync(user, true);

                await _signInManager.SignInAsync(user, isPersistent : false);

                _logger.LogInformation(1, "User enabled two-factor authentication.");
            }
            return(RedirectToAction(nameof(Index), "Account"));
        }