Skip to content

Commit

Permalink
fix: show import error sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
arielsvg committed Sep 7, 2020
1 parent 7f03922 commit a1727b1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/assets/javascripts/directives/views/accountMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ class AccountMenuCtrl extends PureCtrl {
if (!data) {
return;
}
const version = data?.auth_params?.version || data?.keyParams?.version;
if (!protocolManager.supportedVersions().includes(version)) {
this.setState({ importData: null });
this.alertManager.alert({ text: STRING_IMPORT_FAILED_NEWER_BACKUP });
return;
}
if (data.auth_params) {
await this.setState({
importData: {
Expand Down Expand Up @@ -378,15 +384,6 @@ class AccountMenuCtrl extends PureCtrl {
}

async performImport(data, password) {
if (
data.keyParams ||
(data.auth_params && Number(data.auth_params.version) > protocolManager.version())
) {
this.setState({ importData: null });
this.alertManager.alert({ text: STRING_IMPORT_FAILED_NEWER_BACKUP });
return;
}

await this.setState({
importData: {
...this.state.importData,
Expand Down

0 comments on commit a1727b1

Please sign in to comment.