Browse Source

account mvc IsSelfRegistrationEnabled

pull/2573/head
Yunus Emre Kalkan 7 years ago
parent
commit
4ed7d5717f
  1. 5
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml
  2. 3
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs

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

@ -1,5 +1,6 @@
@page @page
@using Volo.Abp.Account.Settings @using Volo.Abp.Account.Settings
@using Volo.Abp.Settings
@model Volo.Abp.Account.Web.Pages.Account.LoginModel @model Volo.Abp.Account.Web.Pages.Account.LoginModel
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage @inherits Volo.Abp.Account.Web.Pages.Account.AccountPage
@inject Volo.Abp.Settings.ISettingProvider SettingProvider @inject Volo.Abp.Settings.ISettingProvider SettingProvider
@ -7,8 +8,8 @@
{ {
<div class="card mt-3 shadow-sm rounded"> <div class="card mt-3 shadow-sm rounded">
<div class="card-body p-5"> <div class="card-body p-5">
<h4>@L["Login"]</h4> <h4>@L["Login"]</h4>
@if (string.Equals(await SettingProvider.GetOrNullAsync(AccountSettingNames.IsSelfRegistrationEnabled), "true", StringComparison.OrdinalIgnoreCase)) @if (await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled))
{ {
<strong> <strong>
@L["AreYouANewUser"] @L["AreYouANewUser"]

3
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs

@ -45,7 +45,8 @@ namespace Volo.Abp.Account.Web.Pages.Account
protected virtual async Task CheckSelfRegistrationAsync() protected virtual async Task CheckSelfRegistrationAsync()
{ {
if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false)) if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false) ||
!await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false))
{ {
throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]);
} }

Loading…
Cancel
Save