mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
This reverts commit 459fb1bcf4.
Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
This commit is contained in:
@@ -116,7 +116,7 @@
|
||||
<bit-label [appTextDrag]="totpCodeCopyObj?.totpCode"
|
||||
>{{ "verificationCodeTotp" | i18n }}
|
||||
<span
|
||||
*ngIf="!(allowTotpGeneration$ | async)"
|
||||
*ngIf="!(isPremium$ | async)"
|
||||
bitBadge
|
||||
variant="success"
|
||||
class="tw-ml-2 tw-cursor-pointer"
|
||||
@@ -130,14 +130,14 @@
|
||||
id="totp"
|
||||
readonly
|
||||
bitInput
|
||||
[type]="!(allowTotpGeneration$ | async) ? 'password' : 'text'"
|
||||
[type]="!(isPremium$ | async) ? 'password' : 'text'"
|
||||
[value]="totpCodeCopyObj?.totpCodeFormatted || '*** ***'"
|
||||
aria-readonly="true"
|
||||
data-testid="login-totp"
|
||||
class="tw-font-mono"
|
||||
/>
|
||||
<div
|
||||
*ngIf="allowTotpGeneration$ | async"
|
||||
*ngIf="isPremium$ | async"
|
||||
bitTotpCountdown
|
||||
[cipher]="cipher"
|
||||
bitSuffix
|
||||
@@ -152,7 +152,7 @@
|
||||
showToast
|
||||
[appA11yTitle]="'copyVerificationCode' | i18n"
|
||||
data-testid="copy-totp"
|
||||
[disabled]="!(allowTotpGeneration$ | async)"
|
||||
[disabled]="!(isPremium$ | async)"
|
||||
class="disabled:tw-cursor-default"
|
||||
></button>
|
||||
</bit-form-field>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user