1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-28 12:45:45 +01: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

@ -1 +1 @@
Subproject commit a26527b500c01fa11931f68d76dfbcf32c442d4e
Subproject commit 370952971ae5421802be97aa466492217620841d

View File

@ -7,6 +7,12 @@
<span>{{organization.name}}</span>
<small class="text-muted">{{'organization' | i18n}}</small>
</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>
<ul class="nav nav-tabs" *ngIf="organization.isAdmin">
<li class="nav-item">

View File

@ -21,7 +21,13 @@
<dt>{{'billingPlan' | i18n}}</dt>
<dd>{{billing.plan}}</dd>
<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>
</dl>
<div class="row" *ngIf="!selfHosted">

View File

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

View File

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

View File

@ -7,6 +7,7 @@
<li *ngFor="let o of organizations">
<a [routerLink]="['/organizations', o.id]" class="text-body">
<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>
</li>
</ul>
@ -47,6 +48,7 @@
</td>
<td>
<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 class="table-list-options">
<div class="dropdown" appListDropdown>

View File

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