Example #1
0
        public async Task <IActionResult> SendCode(string returnTo, bool rememberMe)
        {
            var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();

            if (user == null)
            {
                return(View("Error"));
            }

            var providers = await _userManager.GetValidTwoFactorProvidersAsync(user);


            var providerList = providers.Select(provider => new SelectListItem {
                Value = provider, Text = provider
            })
                               .ToList();


            return(View(new SendCode
            {
                RememberMe = rememberMe,
                ReturnTo = returnTo,
                Providers = providerList
            }));
        }
Example #2
0
        public async Task <IActionResult> OnGet(string returnTo, bool rememberMe)
        {
            var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();

            if (user == null)
            {
                return(RedirectToPage("/Error"));
            }

            var providers = await _userManager.GetValidTwoFactorProvidersAsync(user);


            var providerList = providers.Select(provider => new SelectListItem {
                Value = provider, Text = provider
            })
                               .ToList();

            SendCode = new SendCode()
            {
                Providers  = providerList,
                RememberMe = rememberMe,
                ReturnTo   = returnTo
            };

            return(Page());
        }
Example #3
0
        public async Task <IActionResult> OnGet(string returnTo, bool rememberMe, string provider)
        {
            var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();

            if (user == null)
            {
                return(RedirectToPage("/Error"));
            }

            VerifyCode = new VerifyCode
            {
                RememberMe = rememberMe,
                ReturnTo   = returnTo,
                Provider   = provider
            };

            return(Page());
        }