mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
allow attachments if can access premium
This commit is contained in:
@@ -12,7 +12,7 @@ import { CipherService } from '../../abstractions/cipher.service';
|
|||||||
import { CryptoService } from '../../abstractions/crypto.service';
|
import { CryptoService } from '../../abstractions/crypto.service';
|
||||||
import { I18nService } from '../../abstractions/i18n.service';
|
import { I18nService } from '../../abstractions/i18n.service';
|
||||||
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||||||
import { TokenService } from '../../abstractions/token.service';
|
import { UserService } from '../../abstractions/user.service';
|
||||||
|
|
||||||
import { Cipher } from '../../models/domain/cipher';
|
import { Cipher } from '../../models/domain/cipher';
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(protected cipherService: CipherService, protected analytics: Angulartics2,
|
constructor(protected cipherService: CipherService, protected analytics: Angulartics2,
|
||||||
protected toasterService: ToasterService, protected i18nService: I18nService,
|
protected toasterService: ToasterService, protected i18nService: I18nService,
|
||||||
protected cryptoService: CryptoService, protected tokenService: TokenService,
|
protected cryptoService: CryptoService, protected userService: UserService,
|
||||||
protected platformUtilsService: PlatformUtilsService, protected win: Window) { }
|
protected platformUtilsService: PlatformUtilsService, protected win: Window) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -41,8 +41,8 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
this.cipher = await this.cipherDomain.decrypt();
|
this.cipher = await this.cipherDomain.decrypt();
|
||||||
|
|
||||||
this.hasUpdatedKey = await this.cryptoService.hasEncKey();
|
this.hasUpdatedKey = await this.cryptoService.hasEncKey();
|
||||||
const isPremium = this.tokenService.getPremium();
|
const canAccessPremium = await this.userService.canAccessPremium();
|
||||||
this.canAccessAttachments = isPremium || this.cipher.organizationId != null;
|
this.canAccessAttachments = canAccessPremium || this.cipher.organizationId != null;
|
||||||
|
|
||||||
if (!this.canAccessAttachments) {
|
if (!this.canAccessAttachments) {
|
||||||
const confirmed = await this.platformUtilsService.showDialog(
|
const confirmed = await this.platformUtilsService.showDialog(
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
cipher: CipherView;
|
cipher: CipherView;
|
||||||
showPassword: boolean;
|
showPassword: boolean;
|
||||||
showCardCode: boolean;
|
showCardCode: boolean;
|
||||||
isPremium: boolean;
|
|
||||||
canAccessPremium: boolean;
|
canAccessPremium: boolean;
|
||||||
totpCode: string;
|
totpCode: string;
|
||||||
totpCodeFormatted: string;
|
totpCodeFormatted: string;
|
||||||
@@ -83,8 +82,6 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
|
|
||||||
const cipher = await this.cipherService.get(this.cipherId);
|
const cipher = await this.cipherService.get(this.cipherId);
|
||||||
this.cipher = await cipher.decrypt();
|
this.cipher = await cipher.decrypt();
|
||||||
|
|
||||||
this.isPremium = this.tokenService.getPremium();
|
|
||||||
this.canAccessPremium = await this.userService.canAccessPremium();
|
this.canAccessPremium = await this.userService.canAccessPremium();
|
||||||
|
|
||||||
if (this.cipher.type === CipherType.Login && this.cipher.login.totp &&
|
if (this.cipher.type === CipherType.Login && this.cipher.login.totp &&
|
||||||
@@ -161,7 +158,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cipher.organizationId == null && !this.isPremium) {
|
if (this.cipher.organizationId == null && !this.canAccessPremium) {
|
||||||
this.toasterService.popAsync('error', this.i18nService.t('premiumRequired'),
|
this.toasterService.popAsync('error', this.i18nService.t('premiumRequired'),
|
||||||
this.i18nService.t('premiumRequiredDesc'));
|
this.i18nService.t('premiumRequiredDesc'));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user