src/app/models/multifactor.model.ts
Properties |
Methods |
|
Accessors |
constructor(session?: Session)
|
||||||
Defined in src/app/models/multifactor.model.ts:8
|
||||||
Parameters :
|
allowsEmailMfa |
Type : boolean
|
Defined in src/app/models/multifactor.model.ts:8
|
emailAddress |
Type : string
|
Defined in src/app/models/multifactor.model.ts:5
|
hasGoogleAuth |
Type : boolean
|
Defined in src/app/models/multifactor.model.ts:7
|
phoneNumbers |
Type : Phone[]
|
Defined in src/app/models/multifactor.model.ts:6
|
Private isEmailValid |
isEmailValid()
|
Defined in src/app/models/multifactor.model.ts:25
|
Returns :
boolean
|
Private isPhoneNumbersValid |
isPhoneNumbersValid()
|
Defined in src/app/models/multifactor.model.ts:33
|
Returns :
boolean
|
isValid |
getisValid()
|
Defined in src/app/models/multifactor.model.ts:21
|
import { Session } from '.';
import { Phone } from './phone.model';
export class MultiFactorModel {
emailAddress: string;
phoneNumbers: Phone[];
hasGoogleAuth: boolean;
allowsEmailMfa: boolean;
constructor(session?: Session) {
if (!session) {
return;
}
this.emailAddress = session.email ? session.email : null;
this.phoneNumbers = session.phones ? session.phones : null;
this.hasGoogleAuth = session.hasGoogleAuth ? session.hasGoogleAuth : null;
this.allowsEmailMfa = session.allowsEmailMfa != undefined ? session.allowsEmailMfa : true;
}
get isValid(): boolean {
return this.isEmailValid() || this.isPhoneNumbersValid();
}
private isEmailValid(): boolean {
return (
this.emailAddress !== undefined &&
this.emailAddress !== null &&
this.emailAddress.length > 0
);
}
private isPhoneNumbersValid(): boolean {
return (
this.phoneNumbers !== undefined &&
this.phoneNumbers !== null &&
this.phoneNumbers.length > 0 &&
this.phoneNumbers[0].number !== undefined &&
this.phoneNumbers[0].number !== null &&
this.phoneNumbers[0].number.length > 0
);
}
}