protected void Page_Load(object sender, EventArgs e) { var userId = signinManager.GetVerifiedUserId <ApplicationUser, string>(); if (userId == null) { Response.Redirect("/Account/Error", true); } var userFactors = manager.GetValidTwoFactorProviders(userId); Providers.DataSource = userFactors.Select(x => x).ToList(); Providers.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsSecureConnection) { string url = System.Configuration.ConfigurationManager.AppSettings["SecurePath"] + "Account/RegisterExternalLogin.aspx"; Response.Redirect(url); } var userId = signinManager.GetVerifiedUserId <ApplicationUser, string>(); if (userId == null) { Response.Redirect("/Account/Error", true); } var userFactors = manager.GetValidTwoFactorProviders(userId); Providers.DataSource = userFactors.Select(x => x).ToList(); Providers.DataBind(); }
public IList <string> UserFactors() { var userId = signInManager.GetVerifiedUserId(); if (userId == null) { return(null); } var userFactors = userManager.GetValidTwoFactorProviders(userId); return(userFactors); }
protected void ProviderSubmit_Click(object sender, EventArgs e) { if (!signinManager.SendTwoFactorCode(Providers.SelectedValue)) { Response.Redirect("/Account/Error"); } var user = manager.FindById(signinManager.GetVerifiedUserId <ApplicationUser, string>()); if (user != null) { var code = manager.GenerateTwoFactorToken(user.Id, Providers.SelectedValue); } SelectedProvider.Value = Providers.SelectedValue; sendcode.Visible = false; verifycode.Visible = true; }