1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-26 18:04:07 +01:00

get email verified from token service

This commit is contained in:
Kyle Spearrin 2018-07-02 10:27:27 -04:00
parent 5b5d3069a9
commit 8be95bfe57
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,7 @@ export abstract class TokenService {
tokenNeedsRefresh: (minutes?: number) => boolean;
getUserId: () => string;
getEmail: () => string;
getEmailVerified: () => boolean;
getName: () => string;
getPremium: () => boolean;
getIssuer: () => string;

View File

@ -148,6 +148,15 @@ export class TokenService implements TokenServiceAbstraction {
return decoded.email as string;
}
getEmailVerified(): boolean {
const decoded = this.decodeToken();
if (typeof decoded.email_verified === 'undefined') {
throw new Error('No email verification found');
}
return decoded.email_verified as boolean;
}
getName(): string {
const decoded = this.decodeToken();
if (typeof decoded.name === 'undefined') {