1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

org disabled and license expired warnings

This commit is contained in:
Kyle Spearrin
2018-08-01 16:51:25 -04:00
parent 12bdd87705
commit 6ed80eb6c9
7 changed files with 36 additions and 3 deletions

2
jslib

Submodule jslib updated: a26527b500...370952971a

View File

@@ -7,6 +7,12 @@
<span>{{organization.name}}</span> <span>{{organization.name}}</span>
<small class="text-muted">{{'organization' | i18n}}</small> <small class="text-muted">{{'organization' | i18n}}</small>
</div> </div>
<div class="ml-auto card border-danger text-danger bg-transparent" *ngIf="!organization.enabled">
<div class="card-body py-2">
<i class="fa fa-exclamation-triangle"></i>
{{'organizationIsDisabled' | i18n}}
</div>
</div>
</div> </div>
<ul class="nav nav-tabs" *ngIf="organization.isAdmin"> <ul class="nav nav-tabs" *ngIf="organization.isAdmin">
<li class="nav-item"> <li class="nav-item">

View File

@@ -21,7 +21,13 @@
<dt>{{'billingPlan' | i18n}}</dt> <dt>{{'billingPlan' | i18n}}</dt>
<dd>{{billing.plan}}</dd> <dd>{{billing.plan}}</dd>
<dt>{{'expiration' | i18n}}</dt> <dt>{{'expiration' | i18n}}</dt>
<dd *ngIf="billing.expiration">{{billing.expiration | date:'mediumDate'}}</dd> <dd *ngIf="billing.expiration">
{{billing.expiration | date:'mediumDate'}}
<span *ngIf="isExpired" class="text-danger ml-2">
<i class="fa fa-exclamation-triangle"></i>
{{'licenseIsExpired' | i18n}}
</span>
</dd>
<dd *ngIf="!billing.expiration">{{'neverExpires' | i18n}}</dd> <dd *ngIf="!billing.expiration">{{'neverExpires' | i18n}}</dd>
</dl> </dl>
<div class="row" *ngIf="!selfHosted"> <div class="row" *ngIf="!selfHosted">

View File

@@ -208,6 +208,10 @@ export class OrganizationBillingComponent implements OnInit {
this.platformUtilsService.launchUri(url); this.platformUtilsService.launchUri(url);
} }
get isExpired() {
return this.billing != null && this.billing.expiration != null && this.billing.expiration < new Date();
}
get subscriptionMarkedForCancel() { get subscriptionMarkedForCancel() {
return this.subscription != null && !this.subscription.cancelled && this.subscription.cancelAtEndDate; return this.subscription != null && !this.subscription.cancelled && this.subscription.cancelAtEndDate;
} }

View File

@@ -5,11 +5,15 @@ import {
Router, Router,
} from '@angular/router'; } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { UserService } from 'jslib/abstractions/user.service'; import { UserService } from 'jslib/abstractions/user.service';
@Injectable() @Injectable()
export class OrganizationGuardService implements CanActivate { export class OrganizationGuardService implements CanActivate {
constructor(private userService: UserService, private router: Router) { } constructor(private userService: UserService, private router: Router,
private toasterService: ToasterService, private i18nService: I18nService) { }
async canActivate(route: ActivatedRouteSnapshot) { async canActivate(route: ActivatedRouteSnapshot) {
const org = await this.userService.getOrganization(route.params.organizationId); const org = await this.userService.getOrganization(route.params.organizationId);
@@ -17,6 +21,11 @@ export class OrganizationGuardService implements CanActivate {
this.router.navigate(['/']); this.router.navigate(['/']);
return false; return false;
} }
if (!org.isOwner && !org.enabled) {
this.toasterService.popAsync('error', null, this.i18nService.t('organizationIsDisabled'));
this.router.navigate(['/']);
return false;
}
return true; return true;
} }

View File

@@ -7,6 +7,7 @@
<li *ngFor="let o of organizations"> <li *ngFor="let o of organizations">
<a [routerLink]="['/organizations', o.id]" class="text-body"> <a [routerLink]="['/organizations', o.id]" class="text-body">
<i class="fa-li fa fa-caret-right"></i> {{o.name}} <i class="fa-li fa fa-caret-right"></i> {{o.name}}
<i *ngIf="!o.enabled" class="fa fa-exclamation-triangle text-danger" title="{{'organizationIsDisabled' | i18n}}"></i>
</a> </a>
</li> </li>
</ul> </ul>
@@ -47,6 +48,7 @@
</td> </td>
<td> <td>
<a href="#" [routerLink]="['/organizations', o.id]">{{o.name}}</a> <a href="#" [routerLink]="['/organizations', o.id]">{{o.name}}</a>
<i *ngIf="!o.enabled" class="fa fa-exclamation-triangle text-danger" title="{{'organizationIsDisabled' | i18n}}"></i>
</td> </td>
<td class="table-list-options"> <td class="table-list-options">
<div class="dropdown" appListDropdown> <div class="dropdown" appListDropdown>

View File

@@ -2393,5 +2393,11 @@
"datePasswordUpdated": { "datePasswordUpdated": {
"message": "Password Updated", "message": "Password Updated",
"description": "ex. Date this password was updated" "description": "ex. Date this password was updated"
},
"organizationIsDisabled": {
"message": "Organization is disabled."
},
"licenseIsExpired": {
"message": "License is expired."
} }
} }