From 631184c661aa74150d5ff1e1eff1959103a1e8cf Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 29 May 2020 15:55:16 +0100 Subject: [PATCH] Fix upgrading with already trusted backup --- .../dialogs/secretstorage/CreateSecretStorageDialog.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js index 44e00d79cd..2147f2c8a8 100644 --- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js +++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js @@ -68,7 +68,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent { // does the server offer a UI auth flow with just m.login.password // for /keys/device_signing/upload? (If we have an account password, we // assume that it can) - canUploadKeysWithPasswordOnly: Boolean(this.state.accountPassword), + canUploadKeysWithPasswordOnly: null, canUploadKeyCheckInProgress: false, accountPassword: props.accountPassword || "", accountPasswordCorrect: null, @@ -76,6 +76,12 @@ export default class CreateSecretStorageDialog extends React.PureComponent { useKeyBackup: true, }; + if (props.accountPassword) { + // If we have an account password, we assume we can upload keys with + // just a password (otherwise leave it as null so we poll to check) + this.state.canUploadKeysWithPasswordOnly = true; + } + this._passphraseField = createRef(); this.loadData(); @@ -375,7 +381,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
{_t("Restore your key backup to upgrade your encryption")}
; nextCaption = _t("Restore"); - } else if (this.state.canUploadKeysWithPasswordOnly && !this.state.accountPassword) { + } else if (this.state.canUploadKeysWithPasswordOnly && !this.props.accountPassword) { authPrompt =
{_t("Enter your account password to confirm the upgrade:")}