Commit Graph

114 Commits (63ab7736ca4ab0ee4cfccc8f7b0957b2709e8d2f)

Author SHA1 Message Date
Travis Ralston 0e7688da98 Remove dead Login.loginAsGuest() 2019-04-05 11:00:25 -06:00
J. Ryan Stinnett 328f0cd6bf Notify user when crypto data is missing
If we have account data in local storage but nothing in the crypto store, it
generally means the browser has evicted IndexedDB out from under us. This adds a
modal to explain the situation and offer to completely clear storage to get
things back to normal.

Fixes https://github.com/vector-im/riot-web/issues/9109
2019-03-29 16:06:08 +00:00
J. Ryan Stinnett 4c0f459995 Add basic storage consistency check
This adds a storage consistency check just before creating a client on login.
Each data store we use is checked for data and any problems are logged to the
console.

Fixes https://github.com/vector-im/riot-web/issues/9271
2019-03-26 16:34:13 +00:00
David Baker b39a7e01d3
Merge pull request #2770 from matrix-org/dbkr/fix_instant_rrs_pt2
Fix instantly sending RRs
2019-03-12 10:59:26 +00:00
Travis Ralston 1d71c05201 Localstorage -> LocalStorage 2019-03-08 09:55:50 -07:00
David Baker 7e424ce95b Fix call to stop() 2019-03-08 15:09:44 +00:00
David Baker ce1623691e Fix instantly sending RRs
Splits UserActivity into a tristate of 'active' (last < 1s), 'passive' (lasts a
couple of mins) and neither. Read receipts are sent when 'active', read markers
are sent while 'passive'.

Also fixed a document / window mix-up on the 'blur' handler.

Also adds a unit test for UserActivity because it's quite complex now
(and changes UserActivity to make it testable by accessing the singleton
via sharedInstance() rather than exporting it directly).

Fixes https://github.com/vector-im/riot-web/issues/9023
2019-03-08 12:46:38 +00:00
Travis Ralston 0e16f3a0cc Don't trample over existing sessions when verifying email addresses
Fixes https://github.com/vector-im/riot-web/issues/6875

Instead of overwriting what we have, we'll load the session we have and try to warn the user that they have verified an address for someone else.
2019-03-07 17:09:47 -07:00
J. Ryan Stinnett 20b7debcaf Remove support for team servers 2019-01-25 16:13:30 -06:00
Richard van der Hoff 36dd43f734 Avoid preserving HS url at logout
When I was talking to Matthew about this the other day, we couldn't think of a
good reason why we should preserve the HS URL at logout. It introduces the
problem that, if a client is redirected after login as per MSC1730, and then
you log out, you'll then get a login screen for the wrong server.

So basically there's no reason to have an mx_hs_url/mx_is_url without an access
token, and we can remove the stuff which preserves it, and the stuff that
attempts to restore it.
2018-12-10 14:44:12 +00:00
Richard van der Hoff c553323d5a
Factor out common login code (#2307)
Removes the duplication between the various points where we send off a login
request and parse the response.
2018-12-05 17:39:38 +01:00
David Baker 0abcb5c78d Handle InvalidStoreError from js-sdk
js-sdk now emits sync state ERROR with an InvalidStoreError if the
store needs to be cleared before it can be used.

Requires https://github.com/matrix-org/matrix-js-sdk/pull/759
2018-10-10 17:07:17 +01:00
Bruno Windels 48299bb154 show warning when LL is disabled but was enabled before 2018-10-08 15:28:00 +02:00
Bruno Windels 130f3cc2ff only get component when needed 2018-09-26 16:30:35 +01:00
Bruno Windels 824ad5e318 delete sync data when LL is toggled, show message when enabling 2018-09-26 16:25:21 +01:00
Bruno Windels 07083e61b7
Merge pull request #2058 from matrix-org/t3chguy/hide_logout_warning_whilst_logging_out
while logging out ignore `Session.logged_out` as it is intentional
2018-08-07 10:31:29 +02:00
David Baker acc767a479 s/start/stop/ 2018-07-24 16:39:30 +01:00
David Baker ec4c7ffb71 Make ActiveWidgetStore clear persistent widgets
ActiveWidgetStore is now reponsible for removing the current
persistent widget from the store if it's been removed from whatever
room it was in. As per comment, this leaves us with the store updating
itself in this case but in all other cases, views call setters on the
store to update its state. We should make it so the store keeps itself
up to date and views aren't responsible for keeping the store up to date.

The store now emits events so it can notify PersistentApp when it changes.

Fixes https://github.com/vector-im/riot-web/issues/7076
2018-07-24 16:21:43 +01:00
Michael Telatynski ffe0b35504
while logging out ignore `Session.logged_out` as it is intentional
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2018-07-15 22:33:00 +01:00
David Baker fed74646b0 Rewrite to use async / await 2018-04-27 17:49:53 +01:00
David Baker 2cc50d35c6 Lint 2018-04-27 15:06:36 +01:00
David Baker 75ab618c05 Fix variable scopes 2018-04-27 14:20:09 +01:00
David Baker 0323f8ed0c Wrap exception handling around all of loadSession
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.
2018-04-27 11:25:13 +01:00
David Baker f70096b8fa Fix error handling on session restore
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
2018-04-26 17:07:58 +01:00
Luke Barnard 5d6a447620 Fix bug where global "Never send to unverified..." is ignored 2018-02-22 18:47:27 +00:00
David Baker 87c808a088 semicolon 2017-12-05 11:53:49 +00:00
David Baker fec2e31b41 oops, actual null check 2017-12-05 11:38:25 +00:00
David Baker c23a3fd7fe Add some null checks 2017-12-05 11:14:55 +00:00
Travis Ralston 3958e32672 Ensure blacklistUnverifiedDevices persists reloads
Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-11-04 20:13:23 -07:00
Michael Telatynski 56ea528f43
don't track error messages .2
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-08-10 15:17:52 +01:00
Michael Telatynski bf98c0da7c
un-i18n Modal Analytics
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-07-27 17:19:18 +01:00
Richard van der Hoff 0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff 0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff a06bd84213 replace imports of `q` with bluebird
update `package.json`

```
find src test -name '*.js' |
   xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
   xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff f5f1fe6ae6 Fix a race in session loading code
it was possible for on_logging_in to get dispatched *after* on_logged_in,
causing the app to wedge. Fix it by dispatching on_logging_in synchronously.
2017-07-11 17:09:06 +01:00
Richard van der Hoff a20ed2f632 Add some logging to track down flaky test
We had a test failure where apparently the MatrixClient failed to start
... let's try and figure out why.
2017-07-05 16:20:21 +01:00
Richard van der Hoff efc5cf2889 Remove dead special-casing for OLM.BAD_LEGACY_ACCOUNT_PICKLE
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).
2017-06-21 21:49:41 +01:00
Richard van der Hoff cd73139af5 Various logging cleanups
* 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.
2017-06-20 17:38:02 +01:00
Richard van der Hoff 3b518f2c59 Fix race in registration for pusher config
we no longer immediately create the MatrixClient, so don't assume we do.
2017-06-19 10:22:18 +01:00
Richard van der Hoff db3d9c0573 Make Lifecycle.loadSession return an explicit result
- rather than inferring it from the fact it didn't call logging_in.
2017-06-16 15:23:09 +01:00
Richard van der Hoff eb1fc9ae2d Avoid transitioning to loggedIn state during token login
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.
2017-06-16 15:05:53 +01:00
Richard van der Hoff 65f351ff22 Clear Lifecycle.RtsClient on MatrixChat.mount
- otherwise it ends up sitting around and failing later tests.
2017-06-15 02:15:13 +01:00
Richard van der Hoff 498ea53995 Don't create a guest login if user went to /login
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.
2017-06-14 11:02:38 +01:00
Richard van der Hoff 68e1a7be74 Clear persistent storage on login and logout
Make sure that we don't end up with sensitive data sitting around in the stores
from a previous session.
2017-06-13 12:51:47 +01:00
Luke Barnard 619830617a Merge branch 'develop' into luke/ilag-i18n
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
2017-06-05 16:08:03 +01:00
David Baker c5cd6aecd6 Revert "Call MatrixClient.clearStores on logout"
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.
2017-06-05 15:54:44 +01:00
Richard van der Hoff c3d37c1ff9 Call MatrixClient.clearStores on logout
... to make sure that we don't have any sensitive data sitting around in the
stores.
2017-05-31 18:28:21 +01:00
Richard van der Hoff 4bc252a16b delint src/Lifecycle 2017-05-31 17:28:08 +01:00
Matthew Hodgson e30e45a82c Merge branch 'develop' into new-guest-access 2017-05-30 21:05:07 +01:00
Michael Telatynski 541cea020e use 4/5 of the default custom vars for useful things :D
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-05-29 19:04:37 +01:00