Fix Single Sign-on

https://github.com/matrix-org/matrix-react-sdk/pull/2826 checked
that we had data in the crypto store if the had credentials in
localStorage. However, SSO stores creds in localStorage and then
redirects the browser to remove the loginToken parameter from the
URL without starting crypto, so after the redirect, we see creds
in localStorage but no crypto data, and error.

Fix by marking when we've successfully initialised crypto and only
erroring if that flag is set.

Fixes https://github.com/vector-im/riot-web/issues/9695
This commit is contained in:
David Baker 2019-05-15 13:47:48 +01:00
parent 851d207611
commit 00508367f6
3 changed files with 22 additions and 3 deletions

View file

@ -369,7 +369,7 @@ async function _doSetLoggedIn(credentials, clearStorage) {
// If there's an inconsistency between account data in local storage and the
// crypto store, we'll be generally confused when handling encrypted data.
// Show a modal recommending a full reset of storage.
if (results.dataInLocalStorage && !results.dataInCryptoStore) {
if (results.dataInLocalStorage && results.cryptoInited && !results.dataInCryptoStore) {
const signOut = await _showStorageEvictedDialog();
if (signOut) {
await _clearStorage();