2018-04-04 15:47:43 +02:00
|
|
|
import {
|
2020-08-17 18:14:40 +02:00
|
|
|
Directive,
|
2018-04-04 15:47:43 +02:00
|
|
|
EventEmitter,
|
|
|
|
OnInit,
|
|
|
|
Output,
|
|
|
|
} from '@angular/core';
|
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
|
|
|
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
|
|
|
|
|
|
|
import { AuthService } from '../../abstractions/auth.service';
|
|
|
|
import { I18nService } from '../../abstractions/i18n.service';
|
|
|
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
|
|
|
|
2020-08-17 18:14:40 +02:00
|
|
|
@Directive()
|
2018-04-04 15:47:43 +02:00
|
|
|
export class TwoFactorOptionsComponent implements OnInit {
|
|
|
|
@Output() onProviderSelected = new EventEmitter<TwoFactorProviderType>();
|
|
|
|
@Output() onRecoverSelected = new EventEmitter();
|
|
|
|
|
|
|
|
providers: any[] = [];
|
|
|
|
|
|
|
|
constructor(protected authService: AuthService, protected router: Router,
|
2018-04-07 06:18:31 +02:00
|
|
|
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
|
|
|
|
protected win: Window) { }
|
2018-04-04 15:47:43 +02:00
|
|
|
|
|
|
|
ngOnInit() {
|
2018-05-16 03:11:20 +02:00
|
|
|
this.providers = this.authService.getSupportedTwoFactorProviders(this.win);
|
2018-04-04 15:47:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
choose(p: any) {
|
|
|
|
this.onProviderSelected.emit(p.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
recover() {
|
|
|
|
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/lost-two-step-device/');
|
|
|
|
this.onRecoverSelected.emit();
|
|
|
|
}
|
|
|
|
}
|