diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 63f714e89e..77fb246843 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -101,7 +101,24 @@ export class AppComponent implements OnDestroy, OnInit { break; case 'syncCompleted': break; + case 'upgradeOrganization': + const upgradeConfirmed = await this.platformUtilsService.showDialog( + this.i18nService.t('upgradeOrganizationDesc'), this.i18nService.t('upgradeOrganization'), + this.i18nService.t('upgradeOrganization'), this.i18nService.t('cancel')); + if (upgradeConfirmed) { + this.router.navigate(['organizations', message.organizationId, 'settings', 'billing']); + } + break; + case 'premiumRequired': + const premiumConfirmed = await this.platformUtilsService.showDialog( + this.i18nService.t('premiumRequiredDesc'), this.i18nService.t('premiumRequired'), + this.i18nService.t('learnMore'), this.i18nService.t('cancel')); + if (premiumConfirmed) { + this.router.navigate(['settings/premium']); + } + break; default: + break; } }); }); diff --git a/src/app/organizations/vault/add-edit.component.ts b/src/app/organizations/vault/add-edit.component.ts index 9a23bc9321..fada8af1d0 100644 --- a/src/app/organizations/vault/add-edit.component.ts +++ b/src/app/organizations/vault/add-edit.component.ts @@ -11,6 +11,7 @@ import { AuditService } from 'jslib/abstractions/audit.service'; import { CipherService } from 'jslib/abstractions/cipher.service'; import { FolderService } from 'jslib/abstractions/folder.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StateService } from 'jslib/abstractions/state.service'; @@ -36,9 +37,11 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit { analytics: Angulartics2, toasterService: ToasterService, auditService: AuditService, stateService: StateService, tokenService: TokenService, totpService: TotpService, - passwordGenerationService: PasswordGenerationService, private apiService: ApiService) { + passwordGenerationService: PasswordGenerationService, private apiService: ApiService, + messagingService: MessagingService) { super(cipherService, folderService, i18nService, platformUtilsService, analytics, - toasterService, auditService, stateService, tokenService, totpService, passwordGenerationService); + toasterService, auditService, stateService, tokenService, totpService, passwordGenerationService, + messagingService); } protected async loadCipher() { diff --git a/src/app/organizations/vault/vault.component.ts b/src/app/organizations/vault/vault.component.ts index ddeb4696d9..dac4e895b3 100644 --- a/src/app/organizations/vault/vault.component.ts +++ b/src/app/organizations/vault/vault.component.ts @@ -12,6 +12,7 @@ import { } from '@angular/router'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { MessagingService } from 'jslib/abstractions/messaging.service'; import { SyncService } from 'jslib/abstractions/sync.service'; import { UserService } from 'jslib/abstractions/user.service'; @@ -50,7 +51,7 @@ export class VaultComponent implements OnInit { constructor(private route: ActivatedRoute, private userService: UserService, private location: Location, private router: Router, private syncService: SyncService, private i18nService: I18nService, - private componentFactoryResolver: ComponentFactoryResolver) { } + private componentFactoryResolver: ComponentFactoryResolver, private messagingService: MessagingService) { } ngOnInit() { this.route.parent.params.subscribe(async (params) => { @@ -139,6 +140,11 @@ export class VaultComponent implements OnInit { } editCipherAttachments(cipher: CipherView) { + if (this.organization.maxStorageGb == null || this.organization.maxStorageGb === 0) { + this.messagingService.send('upgradeOrganization', { organizationId: cipher.organizationId }); + return; + } + if (this.modal != null) { this.modal.close(); } diff --git a/src/app/settings/two-factor-setup.component.html b/src/app/settings/two-factor-setup.component.html index c04fc7c324..385c0e87a5 100644 --- a/src/app/settings/two-factor-setup.component.html +++ b/src/app/settings/two-factor-setup.component.html @@ -20,7 +20,7 @@
{{'updateEncryptionKeyShortDesc' | i18n}}
+{{'updateEncryptionKeyShortDesc' | i18n}}
-