2021-12-20 15:47:17 +01:00
|
|
|
import { Component, NgZone, OnDestroy, OnInit } from "@angular/core";
|
2022-07-05 21:25:14 +02:00
|
|
|
import { FormBuilder } from "@angular/forms";
|
2021-12-20 15:47:17 +01:00
|
|
|
import { Router } from "@angular/router";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { RegisterComponent as BaseRegisterComponent } from "@bitwarden/angular/components/register.component";
|
|
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
|
|
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
|
|
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
|
|
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|
|
|
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
2022-07-05 21:25:14 +02:00
|
|
|
import { FormValidationErrorsService } from "@bitwarden/common/abstractions/formValidationErrors.service";
|
2022-06-14 17:10:53 +02:00
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|
|
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
|
|
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
2021-12-20 15:47:17 +01:00
|
|
|
|
|
|
|
const BroadcasterSubscriptionId = "RegisterComponent";
|
2020-11-04 18:09:21 +01:00
|
|
|
|
2018-01-31 20:19:21 +01:00
|
|
|
@Component({
|
2021-12-20 15:47:17 +01:00
|
|
|
selector: "app-register",
|
|
|
|
templateUrl: "register.component.html",
|
2018-01-31 20:19:21 +01:00
|
|
|
})
|
2020-11-04 20:00:44 +01:00
|
|
|
export class RegisterComponent extends BaseRegisterComponent implements OnInit, OnDestroy {
|
2021-12-20 15:47:17 +01:00
|
|
|
constructor(
|
2022-07-05 21:25:14 +02:00
|
|
|
formValidationErrorService: FormValidationErrorsService,
|
|
|
|
formBuilder: FormBuilder,
|
2021-12-20 15:47:17 +01:00
|
|
|
authService: AuthService,
|
|
|
|
router: Router,
|
|
|
|
i18nService: I18nService,
|
|
|
|
cryptoService: CryptoService,
|
|
|
|
apiService: ApiService,
|
|
|
|
stateService: StateService,
|
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
passwordGenerationService: PasswordGenerationService,
|
|
|
|
environmentService: EnvironmentService,
|
|
|
|
private broadcasterService: BroadcasterService,
|
|
|
|
private ngZone: NgZone,
|
|
|
|
logService: LogService
|
|
|
|
) {
|
|
|
|
super(
|
2022-07-05 21:25:14 +02:00
|
|
|
formValidationErrorService,
|
|
|
|
formBuilder,
|
2021-12-20 15:47:17 +01:00
|
|
|
authService,
|
|
|
|
router,
|
|
|
|
i18nService,
|
|
|
|
cryptoService,
|
|
|
|
apiService,
|
|
|
|
stateService,
|
|
|
|
platformUtilsService,
|
|
|
|
passwordGenerationService,
|
|
|
|
environmentService,
|
|
|
|
logService
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
|
|
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
switch (message.command) {
|
|
|
|
case "windowHidden":
|
|
|
|
this.onWindowHidden();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
super.ngOnInit();
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
|
|
|
}
|
|
|
|
|
|
|
|
onWindowHidden() {
|
|
|
|
this.showPassword = false;
|
|
|
|
}
|
2018-01-31 20:19:21 +01:00
|
|
|
}
|