From d3ab19becb7a36bf4c27fe41bddb772f974886cf Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 26 May 2020 14:53:17 -0400 Subject: [PATCH] Check for premium access for totp copying option (#1252) * Check for premium access for totp copying option * restore old null check logic --- src/background/main.background.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 890fea89dc..9e7e367784 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -445,13 +445,15 @@ export default class MainBackground { title: this.i18nService.t('copyPassword'), }); - await this.contextMenusCreate({ - type: 'normal', - id: 'copy-totp', - parentId: 'root', - contexts: ['all'], - title: this.i18nService.t('copyVerificationCode'), - }); + if (await this.userService.canAccessPremium()) { + await this.contextMenusCreate({ + type: 'normal', + id: 'copy-totp', + parentId: 'root', + contexts: ['all'], + title: this.i18nService.t('copyVerificationCode'), + }); + } await this.contextMenusCreate({ type: 'separator', @@ -587,7 +589,8 @@ export default class MainBackground { }); } - if (cipher == null || (cipher.login.totp && cipher.login.totp !== '')) { + const canAccessPremium = await this.userService.canAccessPremium(); + if (canAccessPremium && (cipher == null || (cipher.login.totp && cipher.login.totp !== ''))) { await this.contextMenusCreate({ type: 'normal', id: 'copy-totp_' + idSuffix,