remove unnecessary fields from 2fa providers

This commit is contained in:
Kyle Spearrin 2018-02-02 12:03:05 -05:00
parent 17b9e9b03a
commit 4a3705e675
1 changed files with 6 additions and 16 deletions

View File

@ -22,43 +22,33 @@ import { UserService } from '../abstractions/user.service';
export const TwoFactorProviders = { export const TwoFactorProviders = {
[TwoFactorProviderType.Authenticator]: { [TwoFactorProviderType.Authenticator]: {
type: TwoFactorProviderType.Authenticator,
name: null as string, name: null as string,
description: null as string, description: null as string,
active: true,
free: true,
displayOrder: 0,
priority: 1, priority: 1,
}, },
[TwoFactorProviderType.Yubikey]: { [TwoFactorProviderType.Yubikey]: {
type: TwoFactorProviderType.Yubikey,
name: null as string, name: null as string,
description: null as string, description: null as string,
active: true,
free: false,
displayOrder: 1,
priority: 3, priority: 3,
}, },
[TwoFactorProviderType.Duo]: { [TwoFactorProviderType.Duo]: {
type: TwoFactorProviderType.Duo,
name: 'Duo', name: 'Duo',
description: null as string, description: null as string,
active: true,
free: false,
displayOrder: 2,
priority: 2, priority: 2,
}, },
[TwoFactorProviderType.U2f]: { [TwoFactorProviderType.U2f]: {
type: TwoFactorProviderType.U2f,
name: null as string, name: null as string,
description: null as string, description: null as string,
active: true,
free: false,
displayOrder: 3,
priority: 4, priority: 4,
}, },
[TwoFactorProviderType.Email]: { [TwoFactorProviderType.Email]: {
type: TwoFactorProviderType.Email,
name: null as string, name: null as string,
description: null as string, description: null as string,
active: true,
free: false,
displayOrder: 4,
priority: 0, priority: 0,
}, },
}; };
@ -119,7 +109,7 @@ export class AuthService {
let providerPriority = -1; let providerPriority = -1;
this.twoFactorProviders.forEach((value, type) => { this.twoFactorProviders.forEach((value, type) => {
const provider = (TwoFactorProviders as any)[type]; const provider = (TwoFactorProviders as any)[type];
if (provider != null && provider.active && provider.priority > providerPriority) { if (provider != null && provider.priority > providerPriority) {
if (type === TwoFactorProviderType.U2f && !u2fSupported) { if (type === TwoFactorProviderType.U2f && !u2fSupported) {
return; return;
} }