mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
get email verified from token service
This commit is contained in:
@@ -17,6 +17,7 @@ export abstract class TokenService {
|
|||||||
tokenNeedsRefresh: (minutes?: number) => boolean;
|
tokenNeedsRefresh: (minutes?: number) => boolean;
|
||||||
getUserId: () => string;
|
getUserId: () => string;
|
||||||
getEmail: () => string;
|
getEmail: () => string;
|
||||||
|
getEmailVerified: () => boolean;
|
||||||
getName: () => string;
|
getName: () => string;
|
||||||
getPremium: () => boolean;
|
getPremium: () => boolean;
|
||||||
getIssuer: () => string;
|
getIssuer: () => string;
|
||||||
|
|||||||
@@ -148,6 +148,15 @@ export class TokenService implements TokenServiceAbstraction {
|
|||||||
return decoded.email as string;
|
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 {
|
getName(): string {
|
||||||
const decoded = this.decodeToken();
|
const decoded = this.decodeToken();
|
||||||
if (typeof decoded.name === 'undefined') {
|
if (typeof decoded.name === 'undefined') {
|
||||||
|
|||||||
Reference in New Issue
Block a user