old attachments check when rotating enc key

This commit is contained in:
Kyle Spearrin 2018-11-14 15:54:13 -05:00
parent 1b9943a4c8
commit 6d8b156455
3 changed files with 29 additions and 4 deletions

View File

@ -29,7 +29,7 @@
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="rotateEncKey" name="RotateEncKey" [(ngModel)]="rotateEncKey"
(change)="showEncKeyWarning()">
(change)="rotateEncKeyClicked()">
<label class="form-check-label" for="rotateEncKey">
{{'rotateAccountEncKey' | i18n}}
</label>

View File

@ -128,8 +128,30 @@ export class ChangePasswordComponent implements OnInit {
}, 300);
}
async showEncKeyWarning() {
async rotateEncKeyClicked() {
if (this.rotateEncKey) {
const ciphers = await this.cipherService.getAllDecrypted();
let hasOldAttachments = false;
if (ciphers != null) {
for (let i = 0; i < ciphers.length; i++) {
if (ciphers[i].organizationId == null && ciphers[i].hasOldAttachments) {
hasOldAttachments = true;
break;
}
}
}
if (hasOldAttachments) {
const learnMore = await this.platformUtilsService.showDialog(
this.i18nService.t('oldAttachmentsNeedFixDesc'), null,
this.i18nService.t('learnMore'), this.i18nService.t('close'), 'warning');
if (learnMore) {
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/attachments/');
}
this.rotateEncKey = false;
return;
}
const result = await this.platformUtilsService.showDialog(
this.i18nService.t('updateEncryptionKeyWarning') + ' ' +
this.i18nService.t('rotateEncKeyConfirmation'), this.i18nService.t('rotateEncKeyTitle'),

View File

@ -2541,12 +2541,15 @@
"message": "Are you sure you want to rotate your account's encryption key?"
},
"attachmentsNeedFix": {
"message": "This item has old attachments that need to be fixed."
"message": "This item has old file attachments that need to be fixed."
},
"attachmentFixDesc": {
"message": "This is an old attachment the needs to be fixed. Click to learn more."
"message": "This is an old file attachment the needs to be fixed. Click to learn more."
},
"fix": {
"message": "Fix"
},
"oldAttachmentsNeedFixDesc": {
"message": "There are old file attachments in your vault that need to be fixed before you can rotate your account's encryption key."
}
}