mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
* Add jslib as a dependency * Cleanup tsconfig, webpack, add jslib-angular to package.json * Update all import paths * Add back @types/node. * Lint * Remove dummy module * Remove merge conflict * Group imports * Bump jslib
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import {
|
|
Component,
|
|
OnInit,
|
|
} from '@angular/core';
|
|
import {
|
|
ActivatedRoute,
|
|
Router,
|
|
} from '@angular/router';
|
|
|
|
import { ToasterService } from 'angular2-toaster';
|
|
|
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|
|
|
import { VerifyDeleteRecoverRequest } from 'jslib-common/models/request/verifyDeleteRecoverRequest';
|
|
|
|
@Component({
|
|
selector: 'app-verify-recover-delete',
|
|
templateUrl: 'verify-recover-delete.component.html',
|
|
})
|
|
export class VerifyRecoverDeleteComponent implements OnInit {
|
|
email: string;
|
|
formPromise: Promise<any>;
|
|
|
|
private userId: string;
|
|
private token: string;
|
|
|
|
constructor(private router: Router, private apiService: ApiService,
|
|
private toasterService: ToasterService, private i18nService: I18nService,
|
|
private route: ActivatedRoute) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
let fired = false;
|
|
this.route.queryParams.subscribe(async qParams => {
|
|
if (fired) {
|
|
return;
|
|
}
|
|
fired = true;
|
|
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.toasterService.popAsync('success', this.i18nService.t('accountDeleted'),
|
|
this.i18nService.t('accountDeletedDesc'));
|
|
this.router.navigate(['/']);
|
|
} catch { }
|
|
}
|
|
}
|