Browse Source

Add Abp.Account.EnableLocalLogin setting.

pull/2177/head
maliming 7 years ago
parent
commit
7e0fd93beb
  1. 6
      modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs
  2. 8
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs
  3. 4
      modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs
  4. 2
      modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingNames.cs

6
modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs

@ -12,8 +12,10 @@ using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Account.Web.Settings;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace Volo.Abp.Account.Web.Pages.Account namespace Volo.Abp.Account.Web.Pages.Account
@ -77,7 +79,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
}) })
.ToList(); .ToList();
EnableLocalLogin = true; //TODO: We can get default from a setting? EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin);
if (context?.ClientId != null) if (context?.ClientId != null)
{ {
var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId); var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId);
@ -105,7 +107,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter
public override async Task<IActionResult> OnPostAsync(string action) public override async Task<IActionResult> OnPostAsync(string action)
{ {
EnableLocalLogin = true; //TODO: We can get default from a setting? EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin);
if (action == "Cancel") if (action == "Cancel")
{ {

8
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs

@ -10,8 +10,10 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Account.Web.Settings;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Security.Claims; using Volo.Abp.Security.Claims;
using Volo.Abp.Settings;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using IdentityUser = Volo.Abp.Identity.IdentityUser; using IdentityUser = Volo.Abp.Identity.IdentityUser;
@ -71,8 +73,8 @@ namespace Volo.Abp.Account.Web.Pages.Account
}) })
.ToList(); .ToList();
EnableLocalLogin = true; //TODO: We can get default from a setting? EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin);
ExternalProviders = providers.ToArray(); ExternalProviders = providers.ToArray();
if (IsExternalLoginOnly) if (IsExternalLoginOnly)
@ -87,7 +89,7 @@ namespace Volo.Abp.Account.Web.Pages.Account
[UnitOfWork] //TODO: Will be removed when we implement action filter [UnitOfWork] //TODO: Will be removed when we implement action filter
public virtual async Task<IActionResult> OnPostAsync(string action) public virtual async Task<IActionResult> OnPostAsync(string action)
{ {
EnableLocalLogin = true; //TODO: We can get default from a setting? EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin);
ValidateModel(); ValidateModel();

4
modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingDefinitionProvider.cs

@ -9,6 +9,10 @@ namespace Volo.Abp.Account.Web.Settings
context.Add( context.Add(
new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true") new SettingDefinition(AccountSettingNames.IsSelfRegistrationEnabled, "true")
); );
context.Add(
new SettingDefinition(AccountSettingNames.EnableLocalLogin, "true")
);
} }
} }
} }

2
modules/account/src/Volo.Abp.Account.Web/Settings/AccountSettingNames.cs

@ -3,5 +3,7 @@
public class AccountSettingNames public class AccountSettingNames
{ {
public const string IsSelfRegistrationEnabled = "Abp.Account.IsSelfRegistrationEnabled"; public const string IsSelfRegistrationEnabled = "Abp.Account.IsSelfRegistrationEnabled";
public const string EnableLocalLogin = "Abp.Account.EnableLocalLogin";
} }
} }

Loading…
Cancel
Save