fix: handle keyParams and auth_params in import
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
|||||||
STRING_GENERATING_REGISTER_KEYS,
|
STRING_GENERATING_REGISTER_KEYS,
|
||||||
StringImportError
|
StringImportError
|
||||||
} from '@/strings';
|
} from '@/strings';
|
||||||
|
import { STRING_IMPORT_FAILED_NEWER_BACKUP } from '../../strings';
|
||||||
|
|
||||||
const ELEMENT_ID_IMPORT_PASSWORD_INPUT = 'import-password-request';
|
const ELEMENT_ID_IMPORT_PASSWORD_INPUT = 'import-password-request';
|
||||||
|
|
||||||
@@ -204,7 +205,7 @@ class AccountMenuCtrl extends PureCtrl {
|
|||||||
text: STRING_NON_MATCHING_PASSWORDS
|
text: STRING_NON_MATCHING_PASSWORDS
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.setFormDataState({
|
await this.setFormDataState({
|
||||||
confirmPassword: false,
|
confirmPassword: false,
|
||||||
status: STRING_GENERATING_REGISTER_KEYS,
|
status: STRING_GENERATING_REGISTER_KEYS,
|
||||||
@@ -336,7 +337,7 @@ class AccountMenuCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template
|
* @template
|
||||||
*/
|
*/
|
||||||
async importFileSelected(files) {
|
async importFileSelected(files) {
|
||||||
const run = async () => {
|
const run = async () => {
|
||||||
@@ -377,17 +378,15 @@ class AccountMenuCtrl extends PureCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async performImport(data, password) {
|
async performImport(data, password) {
|
||||||
if (data.keyParams) {
|
if (
|
||||||
if (Number(data.keyParams.version) > 3) {
|
data.keyParams ||
|
||||||
this.setState({
|
(data.auth_params && Number(data.auth_params.version) > protocolManager.version())
|
||||||
importData: null
|
) {
|
||||||
});
|
this.setState({ importData: null });
|
||||||
this.alertManager.alert({
|
this.alertManager.alert({ text: STRING_IMPORT_FAILED_NEWER_BACKUP });
|
||||||
text: "This backup file was created using a later version of the application and cannot be imported."
|
return;
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.setState({
|
await this.setState({
|
||||||
importData: {
|
importData: {
|
||||||
...this.state.importData,
|
...this.state.importData,
|
||||||
|
|||||||
@@ -49,3 +49,5 @@ export function StringImportError({errorCount}) {
|
|||||||
|
|
||||||
/** @password_change */
|
/** @password_change */
|
||||||
export const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
|
export const STRING_FAILED_PASSWORD_CHANGE = "There was an error re-encrypting your items. Your password was changed, but not all your items were properly re-encrypted and synced. You should try syncing again. If all else fails, you should restore your notes from backup.";
|
||||||
|
|
||||||
|
export const STRING_IMPORT_FAILED_NEWER_BACKUP = "This backup file was created using a newer version of the application and cannot be imported here. Please update your application and try again.";
|
||||||
|
|||||||
Reference in New Issue
Block a user