This commit is contained in:
Frederic 2024-05-17 17:20:53 -04:00 committed by GitHub
commit 9953134bdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 8 deletions

View File

@ -65,13 +65,17 @@
</a>
</div>
<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 *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>
</ng-container>
<div [ngClass]="{ 'tw-hidden': !validatedEmail }">

View File

@ -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";
@ -29,6 +29,8 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
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";
@ -39,6 +41,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>;
@ -67,6 +71,7 @@ export class LoginComponent extends BaseLoginComponent implements OnInit {
loginEmailService: LoginEmailServiceAbstraction,
ssoLoginService: SsoLoginServiceAbstraction,
webAuthnLoginService: WebAuthnLoginServiceAbstraction,
private configService: ConfigServiceAbstraction,
) {
super(
devicesApiService,

View File

@ -58,6 +58,7 @@ export class EnvironmentServerConfigData {
identity: string;
notifications: string;
sso: string;
disableUserRegistration: boolean;
constructor(response: Partial<EnvironmentServerConfigResponse>) {
this.cloudRegion = response.cloudRegion;
@ -66,6 +67,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 {

View File

@ -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");
}
}