Privileges for downloading backup from password wizard

This commit is contained in:
Mo Bitar
2018-12-13 12:24:30 -06:00
parent c08a33fd57
commit bc634ca7da
3 changed files with 35 additions and 34 deletions

View File

@@ -351,17 +351,7 @@ class AccountMenu {
*/ */
$scope.downloadDataArchive = async function() { $scope.downloadDataArchive = async function() {
let run = () => { archiveManager.downloadBackup($scope.archiveFormData.encrypted);
archiveManager.downloadBackup($scope.archiveFormData.encrypted);
}
if(await privilegesManager.actionRequiresPrivilege(PrivilegesManager.ActionManageBackups)) {
privilegesManager.presentPrivilegesModal(PrivilegesManager.ActionManageBackups, () => {
run();
});
} else {
run();
}
} }
/* /*

View File

@@ -1,9 +1,10 @@
class ArchiveManager { class ArchiveManager {
constructor(passcodeManager, authManager, modelManager) { constructor(passcodeManager, authManager, modelManager, privilegesManager) {
this.passcodeManager = passcodeManager; this.passcodeManager = passcodeManager;
this.authManager = authManager; this.authManager = authManager;
this.modelManager = modelManager; this.modelManager = modelManager;
this.privilegesManager = privilegesManager;
} }
/* /*
@@ -15,26 +16,36 @@ class ArchiveManager {
} }
async downloadBackupOfItems(items, encrypted) { async downloadBackupOfItems(items, encrypted) {
// download in Standard File format let run = async () => {
var keys, authParams; // download in Standard File format
if(encrypted) { var keys, authParams;
if(this.authManager.offline() && this.passcodeManager.hasPasscode()) { if(encrypted) {
keys = this.passcodeManager.keys(); if(this.authManager.offline() && this.passcodeManager.hasPasscode()) {
authParams = this.passcodeManager.passcodeAuthParams(); keys = this.passcodeManager.keys();
} else { authParams = this.passcodeManager.passcodeAuthParams();
keys = await this.authManager.keys(); } else {
authParams = await this.authManager.getAuthParams(); keys = await this.authManager.keys();
authParams = await this.authManager.getAuthParams();
}
} }
} this.__itemsData(items, keys, authParams).then((data) => {
this.__itemsData(items, keys, authParams).then((data) => { let modifier = encrypted ? "Encrypted" : "Decrypted";
let modifier = encrypted ? "Encrypted" : "Decrypted"; this.__downloadData(data, `Standard Notes ${modifier} Backup - ${this.__formattedDate()}.txt`);
this.__downloadData(data, `Standard Notes ${modifier} Backup - ${this.__formattedDate()}.txt`);
// download as zipped plain text files // download as zipped plain text files
if(!keys) { if(!keys) {
this.__downloadZippedItems(items); this.__downloadZippedItems(items);
} }
}) })
}
if(await this.privilegesManager.actionRequiresPrivilege(PrivilegesManager.ActionManageBackups)) {
this.privilegesManager.presentPrivilegesModal(PrivilegesManager.ActionManageBackups, () => {
run();
});
} else {
run();
}
} }
/* /*

View File

@@ -11,7 +11,7 @@
%div{"ng-if" => "step == 0"} %div{"ng-if" => "step == 0"}
%div{"ng-if" => "changePassword"} %div{"ng-if" => "changePassword"}
%p.sk-p %p.sk-p.sk-panel-row
Changing your password involves changing your encryption key, which requires your data to be re-encrypted and synced. Changing your password involves changing your encryption key, which requires your data to be re-encrypted and synced.
If you have many items, syncing your data can take several minutes. If you have many items, syncing your data can take several minutes.
%p.sk-p.sk-panel-row You must keep the application window open during this process. %p.sk-p.sk-panel-row You must keep the application window open during this process.
@@ -50,9 +50,9 @@
%p.sk-p.bold.sk-panel-row.info-i Please sign out of all applications (excluding this one), including: %p.sk-p.bold.sk-panel-row.info-i Please sign out of all applications (excluding this one), including:
%ul %ul
%li Desktop %li.sk-p Desktop
%li Web (Chrome, Firefox, Safari) %li.sk-p Web (Chrome, Firefox, Safari)
%li Mobile (iOS and Android) %li.sk-p Mobile (iOS and Android)
%p.sk-p.sk-panel-row %p.sk-p.sk-panel-row
If you do not currently have access to a device you're signed in on, you may proceed, If you do not currently have access to a device you're signed in on, you may proceed,
but must make signing out and back in the first step upon gaining access to that device. but must make signing out and back in the first step upon gaining access to that device.