diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index 09392e50b1..7ed98c0d78 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -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) diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index ccd6e07a0f..b1dc1375cd 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -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); } + /// + /// Override this method to add 2FA for your application. + /// + protected virtual Task TwoFactorLoginResultAsync() + { + throw new NotImplementedException(); + } + protected virtual async Task> GetExternalProviders() { var schemes = await SchemeProvider.GetAllSchemesAsync(); diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml deleted file mode 100644 index 4bf575a761..0000000000 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml +++ /dev/null @@ -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 L -

Send security code!

-

TODO: This page is under construction.

diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs deleted file mode 100644 index 56f2e44b85..0000000000 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs +++ /dev/null @@ -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 Providers { get; set; } - - public virtual async Task 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 OnPostAsync() - { - return Task.FromResult(Page()); - } - } -} \ No newline at end of file