Browse Source
Merge pull request #2573 from abpframework/feat/implement-enable-local-login
feat(account): add the enableLocalLogin condition to auth-wrapper
pull/2599/head
Mehmet Erim
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
24 additions and
6 deletions
-
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs
-
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml
-
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs
-
npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html
-
npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts
|
|
|
@ -13,7 +13,7 @@ namespace Volo.Abp.Account.Settings |
|
|
|
AccountSettingNames.IsSelfRegistrationEnabled, |
|
|
|
"true", |
|
|
|
L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), |
|
|
|
L("Description:Abp.Account.IsSelfRegistrationEnabled")) |
|
|
|
L("Description:Abp.Account.IsSelfRegistrationEnabled"), isVisibleToClients : true) |
|
|
|
); |
|
|
|
|
|
|
|
context.Add( |
|
|
|
@ -21,7 +21,7 @@ namespace Volo.Abp.Account.Settings |
|
|
|
AccountSettingNames.EnableLocalLogin, |
|
|
|
"true", |
|
|
|
L("DisplayName:Abp.Account.EnableLocalLogin"), |
|
|
|
L("Description:Abp.Account.EnableLocalLogin")) |
|
|
|
L("Description:Abp.Account.EnableLocalLogin"), isVisibleToClients : true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
@page |
|
|
|
@using Volo.Abp.Account.Settings |
|
|
|
@using Volo.Abp.Settings |
|
|
|
@model Volo.Abp.Account.Web.Pages.Account.LoginModel |
|
|
|
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage |
|
|
|
@inject Volo.Abp.Settings.ISettingProvider SettingProvider |
|
|
|
@ -7,8 +8,8 @@ |
|
|
|
{ |
|
|
|
<div class="card mt-3 shadow-sm rounded"> |
|
|
|
<div class="card-body p-5"> |
|
|
|
<h4>@L["Login"]</h4> |
|
|
|
@if (string.Equals(await SettingProvider.GetOrNullAsync(AccountSettingNames.IsSelfRegistrationEnabled), "true", StringComparison.OrdinalIgnoreCase)) |
|
|
|
<h4>@L["Login"]</h4> |
|
|
|
@if (await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled)) |
|
|
|
{ |
|
|
|
<strong> |
|
|
|
@L["AreYouANewUser"] |
|
|
|
|
|
|
|
@ -45,7 +45,8 @@ namespace Volo.Abp.Account.Web.Pages.Account |
|
|
|
|
|
|
|
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"]); |
|
|
|
} |
|
|
|
|
|
|
|
@ -5,7 +5,10 @@ |
|
|
|
></abp-tenant-box> |
|
|
|
|
|
|
|
<div class="abp-account-container"> |
|
|
|
<div class="card mt-3 shadow-sm rounded"> |
|
|
|
<div |
|
|
|
*ngIf="(enableLocalLogin$ | async) !== 'False'; else disableLocalLoginTemplate" |
|
|
|
class="card mt-3 shadow-sm rounded" |
|
|
|
> |
|
|
|
<div class="card-body p-5"> |
|
|
|
<ng-content *ngTemplateOutlet="mainContentRef"></ng-content> |
|
|
|
</div> |
|
|
|
@ -14,3 +17,10 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<ng-template #disableLocalLoginTemplate> |
|
|
|
<div class="alert alert-warning"> |
|
|
|
<strong>{{ 'AbpAccount::InvalidLoginRequest' | abpLocalization }}</strong> |
|
|
|
{{ 'AbpAccount::ThereAreNoLoginSchemesConfiguredForThisClient' | abpLocalization }} |
|
|
|
</div> |
|
|
|
</ng-template> |
|
|
|
|
|
|
|
@ -1,5 +1,8 @@ |
|
|
|
import { Component, Input, TemplateRef } from '@angular/core'; |
|
|
|
import { Account } from '../../models/account'; |
|
|
|
import { Select } from '@ngxs/store'; |
|
|
|
import { ConfigState } from '@abp/ng.core'; |
|
|
|
import { Observable } from 'rxjs'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'abp-auth-wrapper', |
|
|
|
@ -8,6 +11,9 @@ import { Account } from '../../models/account'; |
|
|
|
}) |
|
|
|
export class AuthWrapperComponent |
|
|
|
implements Account.AuthWrapperComponentInputs, Account.AuthWrapperComponentOutputs { |
|
|
|
@Select(ConfigState.getSetting('Abp.Account.EnableLocalLogin')) |
|
|
|
enableLocalLogin$: Observable<'True' | 'False'>; |
|
|
|
|
|
|
|
@Input() |
|
|
|
readonly mainContentRef: TemplateRef<any>; |
|
|
|
|
|
|
|
|