mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-09 05:57:40 +02:00
78248db590
* Rename service-factory folder
* Move cryptographic service factories
* Move crypto models
* Move crypto services
* Move domain base class
* Platform code owners
* Move desktop log services
* Move log files
* Establish component library ownership
* Move background listeners
* Move background background
* Move localization to Platform
* Move browser alarms to Platform
* Move browser state to Platform
* Move CLI state to Platform
* Move Desktop native concerns to Platform
* Move flag and misc to Platform
* Lint fixes
* Move electron state to platform
* Move web state to Platform
* Move lib state to Platform
* Fix broken tests
* Rename interface to idiomatic TS
* `npm run prettier` 🤖
* Resolve review feedback
* Set platform as owners of web core and shared
* Expand moved services
* Fix test types
---------
Co-authored-by: Hinton <hinton@users.noreply.github.com>
61 lines
2.1 KiB
TypeScript
61 lines
2.1 KiB
TypeScript
import { Component, OnInit } from "@angular/core";
|
|
import { ActivatedRoute, Router } from "@angular/router";
|
|
import { first } from "rxjs/operators";
|
|
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
import { VerifyDeleteRecoverRequest } from "@bitwarden/common/models/request/verify-delete-recover.request";
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
|
|
|
@Component({
|
|
selector: "app-verify-recover-delete",
|
|
templateUrl: "verify-recover-delete.component.html",
|
|
})
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
|
export class VerifyRecoverDeleteComponent implements OnInit {
|
|
email: string;
|
|
formPromise: Promise<any>;
|
|
|
|
private userId: string;
|
|
private token: string;
|
|
|
|
constructor(
|
|
private router: Router,
|
|
private apiService: ApiService,
|
|
private platformUtilsService: PlatformUtilsService,
|
|
private i18nService: I18nService,
|
|
private route: ActivatedRoute,
|
|
private logService: LogService
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
|
this.route.queryParams.pipe(first()).subscribe(async (qParams) => {
|
|
if (qParams.userId != null && qParams.token != null && qParams.email != null) {
|
|
this.userId = qParams.userId;
|
|
this.token = qParams.token;
|
|
this.email = qParams.email;
|
|
} else {
|
|
this.router.navigate(["/"]);
|
|
}
|
|
});
|
|
}
|
|
|
|
async submit() {
|
|
try {
|
|
const request = new VerifyDeleteRecoverRequest(this.userId, this.token);
|
|
this.formPromise = this.apiService.postAccountRecoverDeleteToken(request);
|
|
await this.formPromise;
|
|
this.platformUtilsService.showToast(
|
|
"success",
|
|
this.i18nService.t("accountDeleted"),
|
|
this.i18nService.t("accountDeletedDesc")
|
|
);
|
|
this.router.navigate(["/"]);
|
|
} catch (e) {
|
|
this.logService.error(e);
|
|
}
|
|
}
|
|
}
|