Ask for the user's password to rehydrate their soft logged out session

Fixes https://github.com/vector-im/riot-web/issues/10236

The changes to the MatrixClientPeg (assign/start) are to permit the SoftLogout page to access the MatrixClientPeg reliably. This is why assign() is called by Lifecycle as an alternative to start().

Minimal design work has been done here. The majority is deferred to https://github.com/vector-im/riot-web/issues/10262
This commit is contained in:
Travis Ralston 2019-07-04 16:45:40 -06:00
parent f3c6c73329
commit 93872e6fa5
7 changed files with 190 additions and 13 deletions

View file

@ -120,7 +120,7 @@ class MatrixClientPeg {
this._createClient(creds);
}
async start() {
async assign() {
for (const dbType of ['indexeddb', 'memory']) {
try {
const promise = this.matrixClient.store.startup();
@ -131,7 +131,7 @@ class MatrixClientPeg {
if (dbType === 'indexeddb') {
console.error('Error starting matrixclient store - falling back to memory store', err);
this.matrixClient.store = new Matrix.MemoryStore({
localStorage: global.localStorage,
localStorage: global.localStorage,
});
} else {
console.error('Failed to start memory store!', err);
@ -172,6 +172,12 @@ class MatrixClientPeg {
MatrixActionCreators.start(this.matrixClient);
MatrixClientBackedSettingsHandler.matrixClient = this.matrixClient;
return opts;
}
async start() {
const opts = await this.assign();
console.log(`MatrixClientPeg: really starting MatrixClient`);
await this.get().startClient(opts);
console.log(`MatrixClientPeg: MatrixClient started`);