From 8536e087ab8624d58885510c8038966e86031439 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 22 Apr 2020 14:45:50 +0100 Subject: [PATCH] Skip auth flow test for signing upload when password present If we already have an account password to use during secret storage setup, then it's highly likely that the homeserver accepts passwords for device signing key upload as well. This change then assumes password auth will work without checking to avoid a request when the server is under high load. Fixes https://github.com/vector-im/riot-web/issues/13286 --- .../dialogs/secretstorage/CreateSecretStorageDialog.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js index c5c734a813..2c05f231e7 100644 --- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js +++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js @@ -83,7 +83,15 @@ export default class CreateSecretStorageDialog extends React.PureComponent { }; this._fetchBackupInfo(); - this._queryKeyUploadAuth(); + if (this.state.accountPassword) { + // If we have an account password in memory, let's simplify and + // assume it means password auth is also supported for device + // signing key upload as well. This avoids hitting the server to + // test auth flows, which may be slow under high load. + this.state.canUploadKeysWithPasswordOnly = true; + } else { + this._queryKeyUploadAuth(); + } MatrixClientPeg.get().on('crypto.keyBackupStatus', this._onKeyBackupStatusChange); }