2018-06-21 23:14:36 +02:00
|
|
|
import { Component, ViewChild, ViewContainerRef } from "@angular/core";
|
|
|
|
|
2022-02-24 12:10:07 +01:00
|
|
|
import { ModalService } from "jslib-angular/services/modal.service";
|
2021-06-07 20:13:58 +02:00
|
|
|
import { ApiService } from "jslib-common/abstractions/api.service";
|
2021-11-09 19:24:26 +01:00
|
|
|
import { KeyConnectorService } from "jslib-common/abstractions/keyConnector.service";
|
2021-12-14 17:10:26 +01:00
|
|
|
import { StateService } from "jslib-common/abstractions/state.service";
|
2020-11-10 22:13:42 +01:00
|
|
|
|
2022-02-24 12:10:07 +01:00
|
|
|
import { DeauthorizeSessionsComponent } from "./deauthorize-sessions.component";
|
|
|
|
import { DeleteAccountComponent } from "./delete-account.component";
|
|
|
|
import { PurgeVaultComponent } from "./purge-vault.component";
|
2021-08-27 14:50:58 +02:00
|
|
|
|
2018-06-21 04:27:37 +02:00
|
|
|
@Component({
|
|
|
|
selector: "app-account",
|
|
|
|
templateUrl: "account.component.html",
|
|
|
|
})
|
2018-06-21 21:57:28 +02:00
|
|
|
export class AccountComponent {
|
2020-08-17 16:04:38 +02:00
|
|
|
@ViewChild("deauthorizeSessionsTemplate", { read: ViewContainerRef, static: true })
|
|
|
|
deauthModalRef: ViewContainerRef;
|
|
|
|
@ViewChild("purgeVaultTemplate", { read: ViewContainerRef, static: true })
|
|
|
|
purgeModalRef: ViewContainerRef;
|
|
|
|
@ViewChild("deleteAccountTemplate", { read: ViewContainerRef, static: true })
|
|
|
|
deleteModalRef: ViewContainerRef;
|
2018-06-21 23:14:36 +02:00
|
|
|
|
2021-11-09 19:24:26 +01:00
|
|
|
showChangeEmail = true;
|
|
|
|
|
2021-08-27 14:50:58 +02:00
|
|
|
constructor(
|
|
|
|
private modalService: ModalService,
|
|
|
|
private apiService: ApiService,
|
2021-12-14 17:10:26 +01:00
|
|
|
private keyConnectorService: KeyConnectorService,
|
|
|
|
private stateService: StateService
|
|
|
|
) {}
|
2021-11-09 19:24:26 +01:00
|
|
|
|
|
|
|
async ngOnInit() {
|
2022-05-09 14:21:52 +02:00
|
|
|
this.showChangeEmail = !(await this.keyConnectorService.getUsesKeyConnector());
|
2021-11-09 19:24:26 +01:00
|
|
|
}
|
2018-06-21 23:14:36 +02:00
|
|
|
|
2021-08-27 14:50:58 +02:00
|
|
|
async deauthorizeSessions() {
|
|
|
|
await this.modalService.openViewRef(DeauthorizeSessionsComponent, this.deauthModalRef);
|
2018-06-21 21:57:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-27 14:50:58 +02:00
|
|
|
async purgeVault() {
|
|
|
|
await this.modalService.openViewRef(PurgeVaultComponent, this.purgeModalRef);
|
2018-06-21 21:57:28 +02:00
|
|
|
}
|
|
|
|
|
2021-08-27 14:50:58 +02:00
|
|
|
async deleteAccount() {
|
|
|
|
await this.modalService.openViewRef(DeleteAccountComponent, this.deleteModalRef);
|
2018-06-21 21:57:28 +02:00
|
|
|
}
|
|
|
|
}
|