[SG-659] Classic 2019 plans no longer generating TOTP codes for Free users (#3509)

* [SG-659] Fixed TOTP code visibility for users with classic plans.

* [SG-659] Refactored condition.

* [SG-659] Ran prettier

* [SG-659] Simplified expression.
This commit is contained in:
André Filipe da Silva Bispo 2022-09-13 17:56:10 +01:00 committed by GitHub
parent a4ef63da37
commit acf332b689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 12 deletions

View File

@ -139,7 +139,7 @@
<div
class="box-content-row box-content-row-flex totp"
[ngClass]="{ low: totpLow }"
*ngIf="cipher.login.totp && totpCode && canAccessPremium"
*ngIf="cipher.login.totp && totpCode"
>
<div class="row-main">
<span
@ -178,10 +178,7 @@
</div>
</div>
<div
class="box-content-row box-content-row-flex totp"
*ngIf="cipher.login.totp && !canAccessPremium"
>
<div class="box-content-row box-content-row-flex totp" *ngIf="showPremiumRequiredTotp">
<div class="row-main">
<span class="row-label">{{ "verificationCodeTotp" | i18n }}</span>
<span class="row-label">

View File

@ -100,7 +100,7 @@
<div
class="box-content-row box-content-row-flex totp"
[ngClass]="{ low: totpLow }"
*ngIf="cipher.login.totp && totpCode && canAccessPremium"
*ngIf="cipher.login.totp && totpCode"
>
<div class="row-main">
<span
@ -138,10 +138,7 @@
</button>
</div>
</div>
<div
class="box-content-row box-content-row-flex totp"
*ngIf="cipher.login.totp && !canAccessPremium"
>
<div class="box-content-row box-content-row-flex totp" *ngIf="showPremiumRequiredTotp">
<div class="row-main">
<span class="row-label">{{ "verificationCodeTotp" | i18n }}</span>
<span class="row-label">

View File

@ -182,7 +182,7 @@
<div class="tw-mb-4 tw-ml-4 tw-flex tw-w-1/2 tw-items-end" [ngClass]="{ low: totpLow }">
<div
class="totp tw-flex tw-flex-row tw-items-center"
*ngIf="!cipher.login.totp || (cipher.login.totp && !canAccessPremium)"
*ngIf="!cipher.login.totp || !totpCode"
>
<span class="totp-countdown">
<span class="totp-sec tw-text-muted">15</span>
@ -237,7 +237,7 @@
</a>
</div>
<div
*ngIf="cipher.login.totp && totpCode && canAccessPremium"
*ngIf="cipher.login.totp && totpCode"
class="totp tw-flex tw-flex-row tw-items-center"
>
<span class="totp-countdown">

View File

@ -50,6 +50,7 @@ export class ViewComponent implements OnDestroy, OnInit {
showCardNumber: boolean;
showCardCode: boolean;
canAccessPremium: boolean;
showPremiumRequiredTotp: boolean;
totpCode: string;
totpCodeFormatted: string;
totpDash: number;
@ -108,6 +109,8 @@ export class ViewComponent implements OnDestroy, OnInit {
const cipher = await this.cipherService.get(this.cipherId);
this.cipher = await cipher.decrypt();
this.canAccessPremium = await this.stateService.getCanAccessPremium();
this.showPremiumRequiredTotp =
this.cipher.login.totp && !this.canAccessPremium && !this.cipher.organizationUseTotp;
if (
this.cipher.type === CipherType.Login &&