81 lines
2.9 KiB
TypeScript
81 lines
2.9 KiB
TypeScript
import { Component, NgZone, OnDestroy } from "@angular/core";
|
|
import { ActivatedRoute, Router } from "@angular/router";
|
|
|
|
import { SetPasswordComponent as BaseSetPasswordComponent } from "@bitwarden/angular/components/set-password.component";
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
|
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
|
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
|
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
|
|
|
const BroadcasterSubscriptionId = "SetPasswordComponent";
|
|
|
|
@Component({
|
|
selector: "app-set-password",
|
|
templateUrl: "set-password.component.html",
|
|
})
|
|
export class SetPasswordComponent extends BaseSetPasswordComponent implements OnDestroy {
|
|
constructor(
|
|
apiService: ApiService,
|
|
i18nService: I18nService,
|
|
cryptoService: CryptoService,
|
|
messagingService: MessagingService,
|
|
passwordGenerationService: PasswordGenerationService,
|
|
platformUtilsService: PlatformUtilsService,
|
|
policyApiService: PolicyApiServiceAbstraction,
|
|
policyService: PolicyService,
|
|
router: Router,
|
|
syncService: SyncService,
|
|
route: ActivatedRoute,
|
|
private broadcasterService: BroadcasterService,
|
|
private ngZone: NgZone,
|
|
stateService: StateService,
|
|
organizationApiService: OrganizationApiServiceAbstraction
|
|
) {
|
|
super(
|
|
i18nService,
|
|
cryptoService,
|
|
messagingService,
|
|
passwordGenerationService,
|
|
platformUtilsService,
|
|
policyApiService,
|
|
policyService,
|
|
router,
|
|
apiService,
|
|
syncService,
|
|
route,
|
|
stateService,
|
|
organizationApiService
|
|
);
|
|
}
|
|
|
|
async ngOnInit() {
|
|
await super.ngOnInit();
|
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message) => {
|
|
this.ngZone.run(() => {
|
|
switch (message.command) {
|
|
case "windowHidden":
|
|
this.onWindowHidden();
|
|
break;
|
|
default:
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
|
}
|
|
|
|
onWindowHidden() {
|
|
this.showPassword = false;
|
|
}
|
|
}
|