purge org vault
This commit is contained in:
parent
53675eeba7
commit
7dfb70eb8e
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit d81273c44f97ff709f21623c36b5a4661fea6627
|
Subproject commit d1847690f260cf06ace8ed98b7308edabc3b62c0
|
|
@ -43,6 +43,8 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>{{'dangerZoneDesc' | i18n}}</p>
|
<p>{{'dangerZoneDesc' | i18n}}</p>
|
||||||
<button type="button" class="btn btn-outline-danger" (click)="deleteOrganization()">{{'deleteOrganization' | i18n}}</button>
|
<button type="button" class="btn btn-outline-danger" (click)="deleteOrganization()">{{'deleteOrganization' | i18n}}</button>
|
||||||
|
<button type="button" class="btn btn-outline-danger" (click)="purgeVault()">{{'purgeVault' | i18n}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ng-template #deleteOrganizationTemplate></ng-template>
|
<ng-template #deleteOrganizationTemplate></ng-template>
|
||||||
|
<ng-template #purgeOrganizationTemplate></ng-template>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { OrganizationUpdateRequest } from 'jslib/models/request/organizationUpda
|
||||||
import { OrganizationResponse } from 'jslib/models/response/organizationResponse';
|
import { OrganizationResponse } from 'jslib/models/response/organizationResponse';
|
||||||
|
|
||||||
import { ModalComponent } from '../../modal.component';
|
import { ModalComponent } from '../../modal.component';
|
||||||
|
import { PurgeVaultComponent } from '../../settings/purge-vault.component';
|
||||||
import { DeleteOrganizationComponent } from './delete-organization.component';
|
import { DeleteOrganizationComponent } from './delete-organization.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -25,6 +26,7 @@ import { DeleteOrganizationComponent } from './delete-organization.component';
|
||||||
})
|
})
|
||||||
export class AccountComponent {
|
export class AccountComponent {
|
||||||
@ViewChild('deleteOrganizationTemplate', { read: ViewContainerRef }) deleteModalRef: ViewContainerRef;
|
@ViewChild('deleteOrganizationTemplate', { read: ViewContainerRef }) deleteModalRef: ViewContainerRef;
|
||||||
|
@ViewChild('purgeOrganizationTemplate', { read: ViewContainerRef }) purgeModalRef: ViewContainerRef;
|
||||||
|
|
||||||
loading = true;
|
loading = true;
|
||||||
org: OrganizationResponse;
|
org: OrganizationResponse;
|
||||||
|
@ -78,4 +80,19 @@ export class AccountComponent {
|
||||||
this.modal = null;
|
this.modal = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
purgeVault() {
|
||||||
|
if (this.modal != null) {
|
||||||
|
this.modal.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
|
this.modal = this.purgeModalRef.createComponent(factory).instance;
|
||||||
|
const childComponent = this.modal.show<PurgeVaultComponent>(PurgeVaultComponent, this.purgeModalRef);
|
||||||
|
childComponent.organizationId = this.organizationId;
|
||||||
|
|
||||||
|
this.modal.onClosed.subscribe(async () => {
|
||||||
|
this.modal = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,9 @@ export class EventService {
|
||||||
case EventType.Organization_Updated:
|
case EventType.Organization_Updated:
|
||||||
msg = this.i18nService.t('editedOrgSettings');
|
msg = this.i18nService.t('editedOrgSettings');
|
||||||
break;
|
break;
|
||||||
|
case EventType.Organization_PurgedVault:
|
||||||
|
msg = this.i18nService.t('purgedOrganizationVault');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>{{'purgeVaultDesc' | i18n}}</p>
|
<p>{{(organizationId ? 'purgeOrgVaultDesc' : 'purgeVaultDesc') | i18n}}</p>
|
||||||
<app-callout type="warning">{{'purgeVaultWarning' | i18n}}</app-callout>
|
<app-callout type="warning">{{'purgeVaultWarning' | i18n}}</app-callout>
|
||||||
<label for="masterPassword">{{'masterPass' | i18n}}</label>
|
<label for="masterPassword">{{'masterPass' | i18n}}</label>
|
||||||
<input id="masterPassword" type="password" name="MasterPasswordHash" class="form-control" [(ngModel)]="masterPassword" required
|
<input id="masterPassword" type="password" name="MasterPasswordHash" class="form-control" [(ngModel)]="masterPassword" required
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import { Component } from '@angular/core';
|
import {
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
|
@ -15,6 +18,8 @@ import { PasswordVerificationRequest } from 'jslib/models/request/passwordVerifi
|
||||||
templateUrl: 'purge-vault.component.html',
|
templateUrl: 'purge-vault.component.html',
|
||||||
})
|
})
|
||||||
export class PurgeVaultComponent {
|
export class PurgeVaultComponent {
|
||||||
|
@Input() organizationId?: string = null;
|
||||||
|
|
||||||
masterPassword: string;
|
masterPassword: string;
|
||||||
formPromise: Promise<any>;
|
formPromise: Promise<any>;
|
||||||
|
|
||||||
|
@ -32,11 +37,17 @@ export class PurgeVaultComponent {
|
||||||
const request = new PasswordVerificationRequest();
|
const request = new PasswordVerificationRequest();
|
||||||
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
request.masterPasswordHash = await this.cryptoService.hashPassword(this.masterPassword, null);
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.postPurgeCiphers(request);
|
this.formPromise = this.apiService.postPurgeCiphers(request, this.organizationId);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.analytics.eventTrack.next({ action: 'Purged Vault' });
|
this.analytics.eventTrack.next({
|
||||||
|
action: this.organizationId != null ? 'Purged Organization Vault' : 'Purged Vault',
|
||||||
|
});
|
||||||
this.toasterService.popAsync('success', null, this.i18nService.t('vaultPurged'));
|
this.toasterService.popAsync('success', null, this.i18nService.t('vaultPurged'));
|
||||||
this.router.navigate(['vault']);
|
if (this.organizationId != null) {
|
||||||
|
this.router.navigate(['organizations', this.organizationId, 'vault']);
|
||||||
|
} else {
|
||||||
|
this.router.navigate(['vault']);
|
||||||
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -909,9 +909,15 @@
|
||||||
"purgeVault": {
|
"purgeVault": {
|
||||||
"message": "Purge Vault"
|
"message": "Purge Vault"
|
||||||
},
|
},
|
||||||
|
"purgedOrganizationVault": {
|
||||||
|
"message": "Purged organization vault."
|
||||||
|
},
|
||||||
"purgeVaultDesc": {
|
"purgeVaultDesc": {
|
||||||
"message": "Proceed below to delete all items and folders in your vault. Items that belong to an organization that you share with will not be deleted."
|
"message": "Proceed below to delete all items and folders in your vault. Items that belong to an organization that you share with will not be deleted."
|
||||||
},
|
},
|
||||||
|
"purgeOrgVaultDesc": {
|
||||||
|
"message": "Proceed below to delete all items in the organization's vault."
|
||||||
|
},
|
||||||
"purgeVaultWarning": {
|
"purgeVaultWarning": {
|
||||||
"message": "Purging your vault is permanent. It cannot be undone."
|
"message": "Purging your vault is permanent. It cannot be undone."
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue