mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-28 04:08:47 +02:00
Subscribe to configService.serverConfig$ to retrieve DisableUserRegistration value and hide the button if true
This commit is contained in:
parent
1fdc6629e3
commit
cf9fb6cae7
@ -68,13 +68,17 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<ng-container *ngIf="serverConfig$ | async as serverConfig">
|
||||
<ng-container *ngIf="serverConfig.environment && !serverConfig.environment.disableUserRegistration">
|
||||
<hr />
|
||||
<p class="tw-m-0 tw-text-sm" >
|
||||
{{ "newAroundHere" | i18n }}
|
||||
<!--mousedown event is used over click because it prevents the validation from firing -->
|
||||
<a routerLink="/register" (mousedown)="goToRegister()">{{ "createAccount" | i18n }}</a>
|
||||
</p>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<p class="tw-m-0 tw-text-sm">
|
||||
{{ "newAroundHere" | i18n }}
|
||||
<!--mousedown event is used over click because it prevents the validation from firing -->
|
||||
<a routerLink="/register" (mousedown)="goToRegister()">{{ "createAccount" | i18n }}</a>
|
||||
</p>
|
||||
</ng-container>
|
||||
|
||||
<div [ngClass]="{ 'tw-hidden': !validatedEmail }">
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Component, NgZone, OnInit } from "@angular/core";
|
||||
import { FormBuilder } from "@angular/forms";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { takeUntil } from "rxjs";
|
||||
import { takeUntil, Observable } from "rxjs";
|
||||
import { first } from "rxjs/operators";
|
||||
|
||||
import { LoginComponent as BaseLoginComponent } from "@bitwarden/angular/auth/components/login.component";
|
||||
@ -27,6 +27,8 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
|
||||
import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength";
|
||||
import { ConfigServiceAbstraction } from "@bitwarden/common/platform/abstractions/config/config.service.abstraction";
|
||||
import { ServerConfig } from "@bitwarden/common/platform/abstractions/config/server-config";
|
||||
|
||||
import { flagEnabled } from "../../../utils/flags";
|
||||
import { RouterService, StateService } from "../../core";
|
||||
@ -37,6 +39,8 @@ import { RouterService, StateService } from "../../core";
|
||||
})
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
export class LoginComponent extends BaseLoginComponent implements OnInit {
|
||||
protected serverConfig$: Observable<ServerConfig> = this.configService.serverConfig$;
|
||||
|
||||
showResetPasswordAutoEnrollWarning = false;
|
||||
enforcedPasswordPolicyOptions: MasterPasswordPolicyOptions;
|
||||
policies: ListResponse<PolicyResponse>;
|
||||
@ -65,6 +69,7 @@ export class LoginComponent extends BaseLoginComponent implements OnInit {
|
||||
formValidationErrorService: FormValidationErrorsService,
|
||||
loginService: LoginService,
|
||||
webAuthnLoginService: WebAuthnLoginServiceAbstraction,
|
||||
private configService: ConfigServiceAbstraction,
|
||||
) {
|
||||
super(
|
||||
devicesApiService,
|
||||
|
@ -57,6 +57,7 @@ export class EnvironmentServerConfigData {
|
||||
identity: string;
|
||||
notifications: string;
|
||||
sso: string;
|
||||
disableUserRegistration: boolean;
|
||||
|
||||
constructor(response: Partial<EnvironmentServerConfigResponse>) {
|
||||
this.cloudRegion = response.cloudRegion;
|
||||
@ -65,6 +66,7 @@ export class EnvironmentServerConfigData {
|
||||
this.identity = response.identity;
|
||||
this.notifications = response.notifications;
|
||||
this.sso = response.sso;
|
||||
this.disableUserRegistration = response.disableUserRegistration;
|
||||
}
|
||||
|
||||
static fromJSON(obj: Jsonify<EnvironmentServerConfigData>): EnvironmentServerConfigData {
|
||||
|
@ -30,6 +30,7 @@ export class EnvironmentServerConfigResponse extends BaseResponse {
|
||||
identity: string;
|
||||
notifications: string;
|
||||
sso: string;
|
||||
disableUserRegistration: boolean;
|
||||
|
||||
constructor(data: any = null) {
|
||||
super(data);
|
||||
@ -44,6 +45,7 @@ export class EnvironmentServerConfigResponse extends BaseResponse {
|
||||
this.identity = this.getResponseProperty("Identity");
|
||||
this.notifications = this.getResponseProperty("Notifications");
|
||||
this.sso = this.getResponseProperty("Sso");
|
||||
this.disableUserRegistration = this.getResponseProperty("DisableUserRegistration");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user