-
-
- {{'organizationIsDisabled' | i18n}}
+
+
+
+
+
+ {{organization.name}}
+ {{'organization' | i18n}}
+
+
+
+
+ {{'organizationIsDisabled' | i18n}}
+
+
+
+
+
-
diff --git a/src/app/layouts/organization-layout.component.ts b/src/app/layouts/organization-layout.component.ts
index 67269d9e25..9410d39421 100644
--- a/src/app/layouts/organization-layout.component.ts
+++ b/src/app/layouts/organization-layout.component.ts
@@ -4,11 +4,14 @@ import {
OnDestroy,
OnInit,
} from '@angular/core';
+
import { ActivatedRoute } from '@angular/router';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
+import { ApiService } from 'jslib/abstractions/api.service';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
+import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { UserService } from 'jslib/abstractions/user.service';
import { Organization } from 'jslib/models/domain/organization';
@@ -21,13 +24,14 @@ const BroadcasterSubscriptionId = 'OrganizationLayoutComponent';
})
export class OrganizationLayoutComponent implements OnInit, OnDestroy {
organization: Organization;
-
+ enterpriseTokenPromise: Promise
;
private organizationId: string;
private enterpriseUrl: string;
constructor(private route: ActivatedRoute, private userService: UserService,
- private broadcasterService: BroadcasterService, private environmentService: EnvironmentService,
- private ngZone: NgZone) { }
+ private broadcasterService: BroadcasterService, private ngZone: NgZone,
+ private apiService: ApiService, private platformUtilsService: PlatformUtilsService,
+ private environmentService: EnvironmentService) { }
ngOnInit() {
this.enterpriseUrl = 'https://enterprise.bitwarden.com';
@@ -42,7 +46,6 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
this.organizationId = params.organizationId;
await this.load();
});
-
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
this.ngZone.run(async () => {
switch (message.command) {
@@ -61,4 +64,20 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
async load() {
this.organization = await this.userService.getOrganization(this.organizationId);
}
+
+ async goToEnterprisePortal() {
+ if (this.enterpriseTokenPromise != null) {
+ return;
+ }
+ try {
+ this.enterpriseTokenPromise = this.apiService.getEnterprisePortalSignInToken();
+ const token = await this.enterpriseTokenPromise;
+ if (token != null) {
+ const userId = await this.userService.getUserId();
+ this.platformUtilsService.launchUri(this.enterpriseUrl + '/login?userId=' + userId +
+ '&token=' + (window as any).encodeURIComponent(token) + '&organizationId=' + this.organization.id);
+ }
+ } catch { }
+ this.enterpriseTokenPromise = null;
+ }
}