Add TwoFactorLoginResultAsync for a starting point for 2FA. Remove empty page.

pull/5141/head^2
Halil İbrahim Kalkan 5 years ago
parent 451923ac76
commit de7d480af4

@ -139,12 +139,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
if (result.RequiresTwoFactor)
{
return RedirectToPage("./SendSecurityCode", new
{
returnUrl = ReturnUrl,
returnUrlHash = ReturnUrlHash,
rememberMe = LoginInput.RememberMe
});
return await TwoFactorLoginResultAsync();
}
if (result.IsLockedOut)

@ -107,12 +107,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
if (result.RequiresTwoFactor)
{
return RedirectToPage("./SendSecurityCode", new
{
returnUrl = ReturnUrl,
returnUrlHash = ReturnUrlHash,
rememberMe = LoginInput.RememberMe
});
return await TwoFactorLoginResultAsync();
}
if (result.IsLockedOut)
@ -142,6 +137,14 @@ namespace Volo.Abp.Account.Web.Pages.Account
return RedirectSafely(ReturnUrl, ReturnUrlHash);
}
/// <summary>
/// Override this method to add 2FA for your application.
/// </summary>
protected virtual Task<IActionResult> TwoFactorLoginResultAsync()
{
throw new NotImplementedException();
}
protected virtual async Task<List<ExternalProviderModel>> GetExternalProviders()
{
var schemes = await SchemeProvider.GetAllSchemesAsync();

@ -1,8 +0,0 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Web.Pages.Account
@model SendSecurityCodeModel
@inject IHtmlLocalizer<AccountResource> L
<h2>Send security code!</h2>
<p>TODO: This page is under construction.</p>

@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Volo.Abp.Account.Web.Pages.Account
{
public class SendSecurityCodeModel : AccountPageModel
{
public List<SelectListItem> Providers { get; set; }
public virtual async Task<IActionResult> OnGetAsync()
{
var user = await SignInManager.GetTwoFactorAuthenticationUserAsync();
if (user == null)
{
return RedirectToPage("./Login");
}
return Page();
//CheckCurrentTenant(await SignInManager.GetVerifiedTenantIdAsync());
//Providers = (await UserManager.GetValidTwoFactorProvidersAsync(user))
// .Select(userProvider =>
// new SelectListItem
// {
// Text = userProvider,
// Value = userProvider
// }).ToList();
//return View(
// new SendSecurityCodeViewModel
// {
// ReturnUrl = returnUrl,
// RememberMe = rememberMe
// }
//);
}
public virtual Task<IActionResult> OnPostAsync()
{
return Task.FromResult<IActionResult>(Page());
}
}
}
Loading…
Cancel
Save