public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe) { // 要求用户已通过使用用户名/密码或外部登录名登录 if (!await SignInManager.HasBeenVerifiedAsync()) { return(View("Error")); } var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync()); if (user != null) { var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider); } return(View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe })); }
public async Task <ActionResult> VerifyCode(string provider, string returnUrl, bool rememberMe) { // Require that the user has already logged in via username/password or external login if (!await SignInManager.HasBeenVerifiedAsync()) { return(View("Error")); } var user = await UserManager.FindByIdAsync(await SignInManager.GetVerifiedUserIdAsync()); if (user != null) { var code = await UserManager.GenerateTwoFactorTokenAsync(user.Id, provider); } return(View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe })); }