The user might (probably does) have a session even if we haven't actually tried
to load it yet, so wrap the whole loadSession code in the error handler we were
using for restoring sessions so we gracefully handle exceptions that happen
before trying to restore sessions too.
Remove the catch in MatrixChat that sent you to the login screen. This is
never the right way to handle an error condition: we should only display the
login screen if we successfully determined that the user has no session, or
they explicitly chose to blow their sessions away.
Fix a number of failures that meant the excellent error handling
we had for failing to restore a session didn't work.
1. .catch on the promise rather than try/catch: it's async
2. Explicit cancel method in SessionRestoreErrorDialog that invokes
onFinished with `false` because even with the catch fixed, this
was getting the event as its first arg which is truthy, so
clicking cancel still deleted your data.
3. DialogButtons: Don't pass onCancel straight into the button event
handler as this leaks the MouseEvent through as an argument.
Nothing is using it and it exacerbates failures like this
because there are surprise arguments.
Fixes https://github.com/vector-im/riot-web/issues/6616
We used to show a special error message when we got this error; however
https://github.com/matrix-org/matrix-react-sdk/pull/783 made that not work.
You'll only hit it if you're upgrading from some ancient version of Olm, and
I'm quite happy for us to fall back to the generic 'couldn't restore: vape your
storage?' flow in that case. (In any case that's preferable to dumping you at
the login prompt with no warning that we've just vaped your storage).
* don't just log errors without any context as to where they came from or what
they mean
* avoid the use of '%s' and multi-argument console.log because it looks awful
under karma.
Fixes riot-web#4334
When we do a token login, don't carry on with the normal app startup
(transitioning to the loggedIn state etc) - instead tell the app about the
successful login and wait for it to redirect.
Replace onLoadCompleted with onTokenLoginCompleted so that the app can see what
it's supposed to be doing.
This fixes an unintuitive behaviour where, if you follow a link to
riot.im/app/#/login, we take you to the login page, but not before we've
registered a guest account (or restarted the MatrixClient with the stored
creds).
This actually ends up simplifying some of the startup dance, as we special-case
the registration flows earlier on.
In order to get ILAG internationalised
Conflicts:
src/components/structures/LoggedInView.js
src/components/structures/MatrixChat.js
src/components/views/dialogs/ChatCreateOrReuseDialog.js
src/components/views/dialogs/SetDisplayNameDialog.js
src/createRoom.js
src/i18n/strings/en_EN.json
This reverts commit c3d37c1ff9.
This commit was introducing a bug where no rooms would be shown if
you want straight to /#/login and logged in (because this causes
a guest session to be created but the indexeddb store not to be
cleared, so the new login picks up the stale indexedb sync data.
This wraps session-related state into a basic flux store. The localStorage item 'mx_pass' is the only thing managed by this store for now but it could easily be extended to track other items (like the teamToken which is passed around through props a lot)
To prevent the login screen from flashing when refreshing the app, use some state to indicate that a login is in progress, and OR that with the existing `loading` boolean to show the `<Spinner>` instead of the default `<Login>`.
This might be too invasive, and a default spinner may be better.
Use the on_logged_in dispatch instead. Call setPage in one place, _onLoggedIn, when deciding which page to view on login. Change some require to import, var to const. Remove onTeamMemberRegistered and just use a nullable argument to onRegistered