Also clear data when the deviceId doesn't match
When the HS implementation doesn't respect the device_id parameter erroneously
This commit is contained in:
parent
fca4ebcd72
commit
8ebc03706a
1 changed files with 3 additions and 2 deletions
|
@ -357,14 +357,15 @@ export function setLoggedIn(credentials) {
|
||||||
*/
|
*/
|
||||||
export function hydrateSession(credentials) {
|
export function hydrateSession(credentials) {
|
||||||
const oldUserId = MatrixClientPeg.get().getUserId();
|
const oldUserId = MatrixClientPeg.get().getUserId();
|
||||||
|
const oldDeviceId = MatrixClientPeg.get().getDeviceId();
|
||||||
|
|
||||||
stopMatrixClient(); // unsets MatrixClientPeg.get()
|
stopMatrixClient(); // unsets MatrixClientPeg.get()
|
||||||
localStorage.removeItem("mx_soft_logout");
|
localStorage.removeItem("mx_soft_logout");
|
||||||
_isLoggingOut = false;
|
_isLoggingOut = false;
|
||||||
|
|
||||||
const overwrite = credentials.userId !== oldUserId;
|
const overwrite = credentials.userId !== oldUserId || credentials.deviceId !== oldDeviceId;
|
||||||
if (overwrite) {
|
if (overwrite) {
|
||||||
console.warn("Rehydrating the user's session with a different user's - clearing all data");
|
console.warn("Clearing all data: Old session belongs to a different user/device");
|
||||||
}
|
}
|
||||||
|
|
||||||
return _doSetLoggedIn(credentials, overwrite);
|
return _doSetLoggedIn(credentials, overwrite);
|
||||||
|
|
Loading…
Reference in a new issue