mirror of https://github.com/bitwarden/web.git
9 changed files with 142 additions and 5 deletions
@ -1 +1 @@
@@ -1 +1 @@
|
||||
Subproject commit 32a636e5a5068f705b167f8f16dd15b53493b821 |
||||
Subproject commit 3cc759791e12b7692fc2d2b4be1a2b010eee1c8e |
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<div class="page-header"> |
||||
<h1>{{'twoStepLogin' | i18n}}</h1> |
||||
</div> |
||||
<app-callout type="warning"> |
||||
<p>{{'twoStepLoginRecoveryWarning' | i18n}}</p> |
||||
<button type="button" class="btn btn-outline-secondary">{{'viewRecoveryCode' | i18n}}</button> |
||||
</app-callout> |
||||
<h2 class="mt-5"> |
||||
{{'providers' | i18n}} |
||||
<small *ngIf="loading"> |
||||
<i class="fa fa-spinner fa-spin text-muted"></i> |
||||
</small> |
||||
</h2> |
||||
<ul class="list-group list-group-2fa"> |
||||
<li *ngFor="let p of providers" class="list-group-item d-flex align-items-center"> |
||||
<div class="logo-2fa d-flex justify-content-center"> |
||||
<img [src]="'../images/two-factor/' + p.type + '.png'" alt=""> |
||||
</div> |
||||
<div class="mx-4"> |
||||
<h3 class="mb-0"> |
||||
{{p.name}} |
||||
<i class="fa fa-check text-success fa-fw" *ngIf="p.enabled" title="{{'enabled' | i18n}}"></i> |
||||
<a href="#" appStopClick class="badge badge-primary" *ngIf="!premium && p.premium"> |
||||
{{'premium' | i18n}} |
||||
</a> |
||||
</h3> |
||||
{{p.description}} |
||||
</div> |
||||
<div class="ml-auto"> |
||||
<button type="button" class="btn btn-outline-secondary btn-sm" [disabled]="!premium && p.premium"> |
||||
{{'manage' | i18n}} |
||||
</button> |
||||
</div> |
||||
</li> |
||||
</ul> |
||||
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
import { |
||||
Component, |
||||
OnInit, |
||||
} from '@angular/core'; |
||||
|
||||
import { ToasterService } from 'angular2-toaster'; |
||||
import { Angulartics2 } from 'angulartics2'; |
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service'; |
||||
import { I18nService } from 'jslib/abstractions/i18n.service'; |
||||
import { TokenService } from 'jslib/abstractions/token.service'; |
||||
|
||||
import { TwoFactorProviders } from 'jslib/services/auth.service'; |
||||
|
||||
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType'; |
||||
|
||||
@Component({ |
||||
selector: 'app-two-factor-setup', |
||||
templateUrl: 'two-factor-setup.component.html', |
||||
}) |
||||
export class TwoFactorSetupComponent implements OnInit { |
||||
providers: any[] = []; |
||||
premium: boolean; |
||||
loading = true; |
||||
|
||||
constructor(private apiService: ApiService, private i18nService: I18nService, |
||||
private analytics: Angulartics2, private toasterService: ToasterService, |
||||
private tokenService: TokenService) { } |
||||
|
||||
async ngOnInit() { |
||||
this.premium = this.tokenService.getPremium(); |
||||
|
||||
for (const key in TwoFactorProviders) { |
||||
if (!TwoFactorProviders.hasOwnProperty(key)) { |
||||
continue; |
||||
} |
||||
|
||||
const p = (TwoFactorProviders as any)[key]; |
||||
if (p.type === TwoFactorProviderType.OrganizationDuo) { |
||||
continue; |
||||
} |
||||
|
||||
this.providers.push({ |
||||
type: p.type, |
||||
name: p.name, |
||||
description: p.description, |
||||
enabled: false, |
||||
premium: p.premium, |
||||
sort: p.sort, |
||||
}); |
||||
} |
||||
|
||||
this.providers.sort((a: any, b: any) => a.sort - b.sort); |
||||
await this.load(); |
||||
} |
||||
|
||||
async load() { |
||||
this.loading = true; |
||||
const providerList = await this.apiService.getTwoFactorProviders(); |
||||
providerList.data.forEach((p) => { |
||||
this.providers.forEach((p2) => { |
||||
if (p.type === p2.type) { |
||||
p2.enabled = p.enabled; |
||||
} |
||||
}); |
||||
}); |
||||
this.loading = false; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue