1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Revert "[PM-5718] Fix free organization generating TOTP (#11918)" (#13357)

This reverts commit 459fb1bcf4.

Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
This commit is contained in:
Shane Melton
2025-02-11 11:12:56 -08:00
committed by GitHub
parent 65024a1913
commit 182f9baa0f
9 changed files with 20 additions and 90 deletions

View File

@@ -2,15 +2,7 @@
// @ts-strict-ignore
import { CommonModule, DatePipe } from "@angular/common";
import { Component, inject, Input } from "@angular/core";
import {
BehaviorSubject,
combineLatest,
filter,
map,
Observable,
shareReplay,
switchMap,
} from "rxjs";
import { Observable, switchMap } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
@@ -21,13 +13,13 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import {
BadgeModule,
ColorPasswordModule,
FormFieldModule,
IconButtonModule,
SectionComponent,
SectionHeaderComponent,
TypographyModule,
IconButtonModule,
BadgeModule,
ColorPasswordModule,
} from "@bitwarden/components";
import { BitTotpCountdownComponent } from "../../components/totp-countdown/totp-countdown.component";
@@ -57,31 +49,13 @@ type TotpCodeValues = {
],
})
export class LoginCredentialsViewComponent {
@Input()
get cipher(): CipherView {
return this._cipher$.value;
}
set cipher(value: CipherView) {
this._cipher$.next(value);
}
private _cipher$ = new BehaviorSubject<CipherView>(null);
@Input() cipher: CipherView;
private _userHasPremium$: Observable<boolean> = this.accountService.activeAccount$.pipe(
isPremium$: Observable<boolean> = this.accountService.activeAccount$.pipe(
switchMap((account) =>
this.billingAccountProfileStateService.hasPremiumFromAnySource$(account.id),
),
);
allowTotpGeneration$: Observable<boolean> = combineLatest([
this._userHasPremium$,
this._cipher$.pipe(filter((c) => c != null)),
]).pipe(
map(([userHasPremium, cipher]) => {
// User premium status only applies to personal ciphers, organizationUseTotp applies to organization ciphers
return (userHasPremium && cipher.organizationId == null) || cipher.organizationUseTotp;
}),
shareReplay({ refCount: true, bufferSize: 1 }),
);
showPasswordCount: boolean = false;
passwordRevealed: boolean = false;
totpCodeCopyObj: TotpCodeValues;