2020-11-04 18:09:21 +01:00
|
|
|
import { Component, NgZone, OnDestroy, OnInit } from "@angular/core";
|
2022-07-26 14:48:11 +02:00
|
|
|
import { UntypedFormBuilder } from "@angular/forms";
|
2018-01-31 20:19:21 +01:00
|
|
|
import { Router } from "@angular/router";
|
2021-12-20 15:47:17 +01:00
|
|
|
|
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
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
const BroadcasterSubscriptionId = "RegisterComponent";
|
|
|
|
|
2018-01-31 20:19:21 +01:00
|
|
|
@Component({
|
|
|
|
selector: "app-register",
|
2018-04-06 18:25:22 +02:00
|
|
|
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 {
|
2018-04-04 15:47:49 +02:00
|
|
|
constructor(
|
2022-07-05 21:25:14 +02:00
|
|
|
formValidationErrorService: FormValidationErrorsService,
|
2022-07-26 14:48:11 +02:00
|
|
|
formBuilder: UntypedFormBuilder,
|
2018-04-04 15:47:49 +02:00
|
|
|
authService: AuthService,
|
|
|
|
router: Router,
|
|
|
|
i18nService: I18nService,
|
|
|
|
cryptoService: CryptoService,
|
2018-10-02 15:22:40 +02:00
|
|
|
apiService: ApiService,
|
|
|
|
stateService: StateService,
|
2020-11-04 18:09:21 +01:00
|
|
|
platformUtilsService: PlatformUtilsService,
|
|
|
|
passwordGenerationService: PasswordGenerationService,
|
2021-07-23 20:48:10 +02:00
|
|
|
environmentService: EnvironmentService,
|
|
|
|
private broadcasterService: BroadcasterService,
|
2021-10-21 11:10:36 +02:00
|
|
|
private ngZone: NgZone,
|
|
|
|
logService: LogService
|
|
|
|
) {
|
2018-11-15 21:13:47 +01:00
|
|
|
super(
|
2022-07-05 21:25:14 +02:00
|
|
|
formValidationErrorService,
|
|
|
|
formBuilder,
|
2018-11-15 21:13:47 +01:00
|
|
|
authService,
|
|
|
|
router,
|
|
|
|
i18nService,
|
|
|
|
cryptoService,
|
|
|
|
apiService,
|
|
|
|
stateService,
|
|
|
|
platformUtilsService,
|
2021-10-21 11:10:36 +02:00
|
|
|
passwordGenerationService,
|
|
|
|
environmentService,
|
|
|
|
logService
|
|
|
|
);
|
2018-11-15 21:13:47 +01:00
|
|
|
}
|
2021-12-20 15:47:17 +01:00
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
async ngOnInit() {
|
|
|
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
switch (message.command) {
|
|
|
|
case "windowHidden":
|
|
|
|
this.onWindowHidden();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
});
|
2021-12-20 15:47:17 +01:00
|
|
|
});
|
|
|
|
|
2021-07-23 20:48:10 +02:00
|
|
|
super.ngOnInit();
|
2020-11-04 18:09:21 +01:00
|
|
|
}
|
2021-12-20 15:47:17 +01:00
|
|
|
|
2020-11-04 20:00:44 +01:00
|
|
|
ngOnDestroy() {
|
|
|
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
|
|
|
}
|
2021-12-20 15:47:17 +01:00
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
onWindowHidden() {
|
|
|
|
this.showPassword = false;
|
|
|
|
}
|
2018-01-31 20:19:21 +01:00
|
|
|
}
|