Files
clients/angular/src/components/two-factor-options.component.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-04-04 09:47:43 -04:00
import { Directive, EventEmitter, OnInit, Output } from "@angular/core";
import { Router } from "@angular/router";
import { TwoFactorProviderType } from "jslib-common/enums/twoFactorProviderType";
2018-04-04 09:47:43 -04:00
import { AuthService } from "jslib-common/abstractions/auth.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
2018-04-04 09:47:43 -04:00
@Directive()
2018-04-04 09:47:43 -04:00
export class TwoFactorOptionsComponent implements OnInit {
@Output() onProviderSelected = new EventEmitter<TwoFactorProviderType>();
@Output() onRecoverSelected = new EventEmitter();
2021-12-16 13:36:21 +01:00
2018-04-04 09:47:43 -04:00
providers: any[] = [];
2021-12-16 13:36:21 +01:00
2018-04-04 09:47:43 -04:00
constructor(
protected twoFactorService: TwoFactorService,
2018-04-04 09:47:43 -04:00
protected router: Router,
2018-04-07 00:18:31 -04:00
protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService,
protected win: Window
) {}
2021-12-16 13:36:21 +01:00
2018-04-04 09:47:43 -04:00
ngOnInit() {
this.providers = this.twoFactorService.getSupportedProviders(this.win);
2018-04-04 09:47:43 -04:00
}
2021-12-16 13:36:21 +01:00
2018-04-04 09:47:43 -04:00
choose(p: any) {
this.onProviderSelected.emit(p.type);
}
2021-12-16 13:36:21 +01:00
2018-04-04 09:47:43 -04:00
recover() {
this.platformUtilsService.launchUri("https://help.bitwarden.com/article/lost-two-step-device/");
this.onRecoverSelected.emit();
}
}