From 48ad264e3d7518545bbf190b336d07a47653353a Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 13 Jul 2020 16:44:31 +0800 Subject: [PATCH] The Cancel button is only displayed in Identity Server. Resolve #4731 --- .../Pages/Account/IdentityServerSupportedLoginModel.cs | 2 ++ .../src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml | 9 ++++++--- .../Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) 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 60f55497da..69986a45e9 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 @@ -50,6 +50,8 @@ namespace Volo.Abp.Account.Web.Pages.Account if (context != null) { + ShowCancelButton = true; + LoginInput.UserNameOrEmailAddress = context.LoginHint; //TODO: Reference AspNetCore MultiTenancy module and use options to get the tenant key! diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index 889267d692..656f40850f 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -41,9 +41,12 @@ - + @if (Model.ShowCancelButton) + { + + } } 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 5251cb12f1..e36ff4f95c 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 @@ -51,6 +51,11 @@ namespace Volo.Abp.Account.Web.Pages.Account protected IAuthenticationSchemeProvider SchemeProvider { get; } protected AbpAccountOptions AccountOptions { get; } + /// + /// TODO: Find a better way to implement it. Only show if identity server is used. + /// + public bool ShowCancelButton { get; set; } + public LoginModel( IAuthenticationSchemeProvider schemeProvider, IOptions accountOptions) @@ -83,7 +88,7 @@ namespace Volo.Abp.Account.Web.Pages.Account ValidateModel(); ExternalProviders = await GetExternalProviders(); - + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); await ReplaceEmailToUsernameOfInputIfNeeds();