Commit graph

78 commits

Author SHA1 Message Date
David Baker
33e9abe421 Merge pull request #410 from matrix-org/rav/use_server_device_id
Use server-generated deviceId
2016-08-12 11:40:55 +01:00
Richard van der Hoff
5fc98ffc49 Avoid setting device_id to 'undefined'
Deal with the situation where synapse doesn't give us a device_id on login:
don't set the device_id to 'undefined' in localstorage.
2016-08-12 11:22:04 +01:00
Richard van der Hoff
a29325cc46 Set initial_device_display_name on login and register
Let Vector pass in a default device name, and thread it through everywhere to
set it on login and register calls
2016-08-12 10:55:02 +01:00
Richard van der Hoff
df22768f1b Use server-generated deviceId 2016-08-12 07:31:15 +01:00
Richard van der Hoff
e32c325863 Don't use MatrixClientPeg for temporary clients
Get rid of MatrixClientPeg.replaceUsingUrls, and instead create local,
temporary MatrixClients for the unauthed steps; we therefore only use
MatrixClientPeg for logged-in clients.
2016-08-11 16:23:03 +01:00
Richard van der Hoff
bbfb9291f8 Refactor login token
move the logic for handling login tokens into Lifecycle.loadSession

This means it needs access to the (real) query parmeters, so it depends on
corresponding changes in vector-web.
2016-08-11 11:02:52 +01:00
Richard van der Hoff
1fbddcf6af Use the current HS for guest login
Make sure that we use the homeserver from localstorage for guest regsistration,
in preference to the default.

Also rename the parameters for loadSession
2016-08-11 01:39:33 +01:00
Richard van der Hoff
5b9d395234 Yet another fix to session saving
I've written tests this time, and everything.
2016-08-11 00:58:48 +01:00
Richard van der Hoff
a85259c2b7 Fix session persistence
https://github.com/matrix-org/matrix-react-sdk/pull/404 messed this up
somewhat; hopefully this gets it right
2016-08-10 23:52:09 +01:00
David Baker
92762eca74 Fix settings resetting on refresh
Don't clear localstorage when replacing the client: we clear it when logging out so this is just redundant, and since we now use replaceClient to unpickle a session from localstorage, this was blowing away all our setting on every refresh.

Also Move all of the localstorage code to Lifecycle (except device ID but this will probably be generated on the server soon anyway). We previously cleared localstorage on logout in Lifecycle so persist the session in Lifecycle.setLoggedIn() to be symmetrical.
2016-08-10 18:04:22 +01:00
Richard van der Hoff
3922f6a1b7 Move rehydration of MatrixClients from MatrixClientPeg to SessionLoader
This means that we don't create a spurious MatrixClient which is thrown away by
the SessionLoader (whilst still ensuring that the rehydrated matrixclient
follows the same code path as matrixclients created at other points in the
session load process).
2016-08-10 11:59:24 +01:00
Richard van der Hoff
26c7c9e994 Make SessionLoader a function
There's no point in it being a React component.
2016-08-10 11:36:26 +01:00
Richard van der Hoff
24841cc5c4 Start to factor out session-loading magic
Take some of the magic out of MatrixChat.componentDidMount() into a new
component.

Also delete the MatrixChat test. It wasn't really doing much, is broken by the
change, and I am replacing it with (better) app-level tests in the vector
project.
2016-08-10 00:05:44 +01:00
David Baker
e144da75e3 Comment onLoggedOut & consistent comment style 2016-08-04 10:49:34 +01:00
David Baker
afa46a855b Merge remote-tracking branch 'origin/develop' into dbkr/deactivate_account 2016-08-03 17:52:35 +01:00
David Baker
0919e41469 Fix MatrixClientPeg.start()
Move import & use `this`
2016-08-03 16:45:23 +01:00
David Baker
9bf45fb556 Add start wrapper in MatrixClientPeg
to handle the opts dictionary
2016-08-03 16:39:47 +01:00
David Baker
b95a1c4a4b Just doc with the MatrixClientCreds object 2016-08-03 16:31:42 +01:00
David Baker
a5384d32e2 Copy opts to set pendingEventOrdering 2016-08-03 16:28:37 +01:00
David Baker
ffa97a4095 Log out when account is deactivated 2016-08-03 11:47:29 +01:00
David Baker
d9a7d50a03 Add an interface for MatrixClientCreds
and make MatrixClientPeg functions use it consistently
2016-08-03 10:46:42 +01:00
David Baker
1f17b78371 log if we can't log out 2016-08-03 10:01:23 +01:00
David Baker
40834d188e Don't let pendingEventOrdering be changed 2016-08-02 18:58:18 +01:00
David Baker
77a5384bf8 Comment startMatrixClient 2016-08-02 18:56:12 +01:00
David Baker
c2c548ef5a Comment logout 2016-08-02 18:55:13 +01:00
David Baker
b9a5f7902b Doc setLoggedIn & remove redundant opts 2016-08-02 18:52:56 +01:00
David Baker
58bbb35096 s/login/setLoggedIn/ 2016-08-02 18:48:27 +01:00
David Baker
db9750a7e3 Call the logout API when we log out
Also try to refactor some of the login/logout code out of MatrixChat and into a separate Lifecycle.js. This still isn't great, but it at least gets some code out of MatrixClient.
2016-08-02 14:04:20 +01:00