mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +00:00
This reverts commit 459fb1bcf4.
Co-authored-by: SmithThe4th <gsmithwalter@gmail.com>
This commit is contained in:
@@ -318,20 +318,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "upgradeOrganization": {
|
|
||||||
const upgradeConfirmed = await this.dialogService.openSimpleDialog({
|
|
||||||
title: { key: "upgradeOrganization" },
|
|
||||||
content: { key: "upgradeOrganizationDesc" },
|
|
||||||
acceptButtonText: { key: "learnMore" },
|
|
||||||
type: "info",
|
|
||||||
});
|
|
||||||
if (upgradeConfirmed) {
|
|
||||||
this.platformUtilsService.launchUri(
|
|
||||||
"https://bitwarden.com/help/upgrade-from-individual-to-org/",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "emailVerificationRequired": {
|
case "emailVerificationRequired": {
|
||||||
const emailVerificationConfirmed = await this.dialogService.openSimpleDialog({
|
const emailVerificationConfirmed = await this.dialogService.openSimpleDialog({
|
||||||
title: { key: "emailVerificationRequired" },
|
title: { key: "emailVerificationRequired" },
|
||||||
|
|||||||
@@ -3502,15 +3502,6 @@
|
|||||||
"allowScreenshotsDesc": {
|
"allowScreenshotsDesc": {
|
||||||
"message": "Allow the Bitwarden desktop application to be captured in screenshots and viewed in remote desktop sessions. Disabling this will prevent access on some external displays."
|
"message": "Allow the Bitwarden desktop application to be captured in screenshots and viewed in remote desktop sessions. Disabling this will prevent access on some external displays."
|
||||||
},
|
},
|
||||||
"organizationUpgradeRequired": {
|
|
||||||
"message": "Organization upgrade required"
|
|
||||||
},
|
|
||||||
"upgradeOrganization": {
|
|
||||||
"message": "Upgrade organization"
|
|
||||||
},
|
|
||||||
"upgradeOrganizationDesc": {
|
|
||||||
"message": "This feature is not available for free organizations. Switch to a paid plan to unlock more features."
|
|
||||||
},
|
|
||||||
"confirmWindowStillVisibleTitle": {
|
"confirmWindowStillVisibleTitle": {
|
||||||
"message": "Confirm window still visible"
|
"message": "Confirm window still visible"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -186,16 +186,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content-row box-content-row-flex totp" *ngIf="showUpgradeRequiredTotp">
|
|
||||||
<div class="row-main">
|
|
||||||
<span class="row-label">{{ "verificationCodeTotp" | i18n }}</span>
|
|
||||||
<span class="row-label">
|
|
||||||
<a [routerLink]="" (click)="upgradeOrganization()"
|
|
||||||
>{{ "organizationUpgradeRequired" | i18n }}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Card -->
|
<!-- Card -->
|
||||||
<div *ngIf="cipher.card">
|
<div *ngIf="cipher.card">
|
||||||
|
|||||||
@@ -159,10 +159,4 @@ export class ViewComponent extends BaseViewComponent implements OnInit, OnDestro
|
|||||||
this.messagingService.send("premiumRequired");
|
this.messagingService.send("premiumRequired");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
upgradeOrganization() {
|
|
||||||
this.messagingService.send("upgradeOrganization", {
|
|
||||||
organizationId: this.cipher.organizationId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
|||||||
protected messagingService: MessagingService,
|
protected messagingService: MessagingService,
|
||||||
eventCollectionService: EventCollectionService,
|
eventCollectionService: EventCollectionService,
|
||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
protected organizationService: OrganizationService,
|
organizationService: OrganizationService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
passwordRepromptService: PasswordRepromptService,
|
passwordRepromptService: PasswordRepromptService,
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
@@ -303,8 +303,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
|
|||||||
this.cipher.type === CipherType.Login &&
|
this.cipher.type === CipherType.Login &&
|
||||||
this.cipher.login.totp &&
|
this.cipher.login.totp &&
|
||||||
this.organization?.productTierType != ProductTierType.Free &&
|
this.organization?.productTierType != ProductTierType.Free &&
|
||||||
((this.canAccessPremium && this.cipher.organizationId == null) ||
|
(this.cipher.organizationUseTotp || this.canAccessPremium)
|
||||||
this.cipher.organizationUseTotp)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
|
|||||||
protected policyService: PolicyService,
|
protected policyService: PolicyService,
|
||||||
protected logService: LogService,
|
protected logService: LogService,
|
||||||
protected passwordRepromptService: PasswordRepromptService,
|
protected passwordRepromptService: PasswordRepromptService,
|
||||||
protected organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
protected dialogService: DialogService,
|
protected dialogService: DialogService,
|
||||||
protected win: Window,
|
protected win: Window,
|
||||||
protected datePipe: DatePipe,
|
protected datePipe: DatePipe,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import { CollectionId } from "@bitwarden/common/types/guid";
|
|||||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
|
||||||
import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/vault/abstractions/totp.service";
|
||||||
import { FieldType, CipherType } from "@bitwarden/common/vault/enums";
|
import { CipherType, FieldType } from "@bitwarden/common/vault/enums";
|
||||||
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type";
|
||||||
import { Launchable } from "@bitwarden/common/vault/interfaces/launchable";
|
import { Launchable } from "@bitwarden/common/vault/interfaces/launchable";
|
||||||
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view";
|
||||||
@@ -65,7 +65,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
showPrivateKey: boolean;
|
showPrivateKey: boolean;
|
||||||
canAccessPremium: boolean;
|
canAccessPremium: boolean;
|
||||||
showPremiumRequiredTotp: boolean;
|
showPremiumRequiredTotp: boolean;
|
||||||
showUpgradeRequiredTotp: boolean;
|
|
||||||
totpCode: string;
|
totpCode: string;
|
||||||
totpCodeFormatted: string;
|
totpCodeFormatted: string;
|
||||||
totpDash: number;
|
totpDash: number;
|
||||||
@@ -161,25 +160,22 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
this.billingAccountProfileStateService.hasPremiumFromAnySource$(activeUserId),
|
this.billingAccountProfileStateService.hasPremiumFromAnySource$(activeUserId),
|
||||||
);
|
);
|
||||||
this.showPremiumRequiredTotp =
|
this.showPremiumRequiredTotp =
|
||||||
this.cipher.login.totp && !this.canAccessPremium && !this.cipher.organizationId;
|
this.cipher.login.totp && !this.canAccessPremium && !this.cipher.organizationUseTotp;
|
||||||
this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher, [
|
this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher, [
|
||||||
this.collectionId as CollectionId,
|
this.collectionId as CollectionId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.showUpgradeRequiredTotp =
|
|
||||||
this.cipher.login.totp && this.cipher.organizationId && !this.cipher.organizationUseTotp;
|
|
||||||
|
|
||||||
if (this.cipher.folderId) {
|
if (this.cipher.folderId) {
|
||||||
this.folder = await (
|
this.folder = await (
|
||||||
await firstValueFrom(this.folderService.folderViews$(activeUserId))
|
await firstValueFrom(this.folderService.folderViews$(activeUserId))
|
||||||
).find((f) => f.id == this.cipher.folderId);
|
).find((f) => f.id == this.cipher.folderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const canGenerateTotp = this.cipher.organizationId
|
if (
|
||||||
? this.cipher.organizationUseTotp
|
this.cipher.type === CipherType.Login &&
|
||||||
: this.canAccessPremium;
|
this.cipher.login.totp &&
|
||||||
|
(this.cipher.organizationUseTotp || this.canAccessPremium)
|
||||||
if (this.cipher.type === CipherType.Login && this.cipher.login.totp && canGenerateTotp) {
|
) {
|
||||||
await this.totpUpdateCode();
|
await this.totpUpdateCode();
|
||||||
const interval = this.totpService.getTimeInterval(this.cipher.login.totp);
|
const interval = this.totpService.getTimeInterval(this.cipher.login.totp);
|
||||||
await this.totpTick(interval);
|
await this.totpTick(interval);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
<bit-label [appTextDrag]="totpCodeCopyObj?.totpCode"
|
<bit-label [appTextDrag]="totpCodeCopyObj?.totpCode"
|
||||||
>{{ "verificationCodeTotp" | i18n }}
|
>{{ "verificationCodeTotp" | i18n }}
|
||||||
<span
|
<span
|
||||||
*ngIf="!(allowTotpGeneration$ | async)"
|
*ngIf="!(isPremium$ | async)"
|
||||||
bitBadge
|
bitBadge
|
||||||
variant="success"
|
variant="success"
|
||||||
class="tw-ml-2 tw-cursor-pointer"
|
class="tw-ml-2 tw-cursor-pointer"
|
||||||
@@ -130,14 +130,14 @@
|
|||||||
id="totp"
|
id="totp"
|
||||||
readonly
|
readonly
|
||||||
bitInput
|
bitInput
|
||||||
[type]="!(allowTotpGeneration$ | async) ? 'password' : 'text'"
|
[type]="!(isPremium$ | async) ? 'password' : 'text'"
|
||||||
[value]="totpCodeCopyObj?.totpCodeFormatted || '*** ***'"
|
[value]="totpCodeCopyObj?.totpCodeFormatted || '*** ***'"
|
||||||
aria-readonly="true"
|
aria-readonly="true"
|
||||||
data-testid="login-totp"
|
data-testid="login-totp"
|
||||||
class="tw-font-mono"
|
class="tw-font-mono"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
*ngIf="allowTotpGeneration$ | async"
|
*ngIf="isPremium$ | async"
|
||||||
bitTotpCountdown
|
bitTotpCountdown
|
||||||
[cipher]="cipher"
|
[cipher]="cipher"
|
||||||
bitSuffix
|
bitSuffix
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
showToast
|
showToast
|
||||||
[appA11yTitle]="'copyVerificationCode' | i18n"
|
[appA11yTitle]="'copyVerificationCode' | i18n"
|
||||||
data-testid="copy-totp"
|
data-testid="copy-totp"
|
||||||
[disabled]="!(allowTotpGeneration$ | async)"
|
[disabled]="!(isPremium$ | async)"
|
||||||
class="disabled:tw-cursor-default"
|
class="disabled:tw-cursor-default"
|
||||||
></button>
|
></button>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|||||||
@@ -2,15 +2,7 @@
|
|||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { CommonModule, DatePipe } from "@angular/common";
|
import { CommonModule, DatePipe } from "@angular/common";
|
||||||
import { Component, inject, Input } from "@angular/core";
|
import { Component, inject, Input } from "@angular/core";
|
||||||
import {
|
import { Observable, switchMap } from "rxjs";
|
||||||
BehaviorSubject,
|
|
||||||
combineLatest,
|
|
||||||
filter,
|
|
||||||
map,
|
|
||||||
Observable,
|
|
||||||
shareReplay,
|
|
||||||
switchMap,
|
|
||||||
} from "rxjs";
|
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
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 { PremiumUpgradePromptService } from "@bitwarden/common/vault/abstractions/premium-upgrade-prompt.service";
|
||||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||||
import {
|
import {
|
||||||
BadgeModule,
|
|
||||||
ColorPasswordModule,
|
|
||||||
FormFieldModule,
|
FormFieldModule,
|
||||||
IconButtonModule,
|
|
||||||
SectionComponent,
|
SectionComponent,
|
||||||
SectionHeaderComponent,
|
SectionHeaderComponent,
|
||||||
TypographyModule,
|
TypographyModule,
|
||||||
|
IconButtonModule,
|
||||||
|
BadgeModule,
|
||||||
|
ColorPasswordModule,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
import { BitTotpCountdownComponent } from "../../components/totp-countdown/totp-countdown.component";
|
import { BitTotpCountdownComponent } from "../../components/totp-countdown/totp-countdown.component";
|
||||||
@@ -57,31 +49,13 @@ type TotpCodeValues = {
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class LoginCredentialsViewComponent {
|
export class LoginCredentialsViewComponent {
|
||||||
@Input()
|
@Input() cipher: CipherView;
|
||||||
get cipher(): CipherView {
|
|
||||||
return this._cipher$.value;
|
|
||||||
}
|
|
||||||
set cipher(value: CipherView) {
|
|
||||||
this._cipher$.next(value);
|
|
||||||
}
|
|
||||||
private _cipher$ = new BehaviorSubject<CipherView>(null);
|
|
||||||
|
|
||||||
private _userHasPremium$: Observable<boolean> = this.accountService.activeAccount$.pipe(
|
isPremium$: Observable<boolean> = this.accountService.activeAccount$.pipe(
|
||||||
switchMap((account) =>
|
switchMap((account) =>
|
||||||
this.billingAccountProfileStateService.hasPremiumFromAnySource$(account.id),
|
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;
|
showPasswordCount: boolean = false;
|
||||||
passwordRevealed: boolean = false;
|
passwordRevealed: boolean = false;
|
||||||
totpCodeCopyObj: TotpCodeValues;
|
totpCodeCopyObj: TotpCodeValues;
|
||||||
|
|||||||
Reference in New Issue
Block a user