mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
Check IS v2 account tokens for validity
Fixes https://github.com/vector-im/riot-web/issues/10452
This commit is contained in:
parent
e33109cb8c
commit
36308b9ebf
1 changed files with 5 additions and 9 deletions
|
@ -56,16 +56,10 @@ export default class IdentityAuthClient {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
_checkToken(token) {
|
async _checkToken(token) {
|
||||||
// TODO: Test current API token via `/account` endpoint
|
await MatrixClientPeg.get().getIdentityAccount(token);
|
||||||
|
|
||||||
// At the moment, Sydent doesn't implement `/account`, so we can't use
|
// We should ensure the token in `localStorage` is cleared
|
||||||
// that yet. We could try a lookup for a null address perhaps...?
|
|
||||||
// Sydent doesn't currently expire tokens, but we should still be testing
|
|
||||||
// them in any case.
|
|
||||||
// See also https://github.com/vector-im/riot-web/issues/10452.
|
|
||||||
|
|
||||||
// In any case, we should ensure the token in `localStorage` is cleared
|
|
||||||
// appropriately. We already clear storage on sign out, but we'll need
|
// appropriately. We already clear storage on sign out, but we'll need
|
||||||
// additional clearing when changing ISes in settings as part of future
|
// additional clearing when changing ISes in settings as part of future
|
||||||
// privacy work.
|
// privacy work.
|
||||||
|
@ -86,7 +80,9 @@ export default class IdentityAuthClient {
|
||||||
// See https://github.com/vector-im/riot-web/issues/10443
|
// See https://github.com/vector-im/riot-web/issues/10443
|
||||||
console.warn("IS doesn't support v2 auth");
|
console.warn("IS doesn't support v2 auth");
|
||||||
this.authEnabled = false;
|
this.authEnabled = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
console.error(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue