2018-07-12 17:34:51 +02:00
|
|
|
import { Component } from "@angular/core";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
|
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|
|
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
2018-07-12 17:34:51 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-verify-email",
|
|
|
|
templateUrl: "verify-email.component.html",
|
|
|
|
})
|
|
|
|
export class VerifyEmailComponent {
|
|
|
|
actionPromise: Promise<any>;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private apiService: ApiService,
|
|
|
|
private i18nService: I18nService,
|
2021-12-07 20:41:45 +01:00
|
|
|
private platformUtilsService: PlatformUtilsService,
|
|
|
|
private logService: LogService
|
|
|
|
) {}
|
2018-07-12 17:34:51 +02:00
|
|
|
|
|
|
|
async send() {
|
|
|
|
if (this.actionPromise != null) {
|
|
|
|
return;
|
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
try {
|
2018-07-12 17:34:51 +02:00
|
|
|
this.actionPromise = this.apiService.postAccountVerifyEmail();
|
|
|
|
await this.actionPromise;
|
2021-12-07 20:41:45 +01:00
|
|
|
this.platformUtilsService.showToast(
|
2021-12-17 15:57:11 +01:00
|
|
|
"success",
|
|
|
|
null,
|
2021-12-07 20:41:45 +01:00
|
|
|
this.i18nService.t("checkInboxForVerification")
|
2021-12-17 15:57:11 +01:00
|
|
|
);
|
2021-10-20 18:30:04 +02:00
|
|
|
} catch (e) {
|
|
|
|
this.logService.error(e);
|
2021-12-17 15:57:11 +01:00
|
|
|
}
|
2018-07-12 17:34:51 +02:00
|
|
|
this.actionPromise = null;
|
2021-12-17 15:57:11 +01:00
|
|
|
}
|
2018-07-12 17:34:51 +02:00
|
|
|
}
|