forked from mystiq/hydrogen-web
require a flag to enable account setup during login
as it blocks login from progressing, any sdk usage should enable to indicate they are listening for the AccountSetup status.
This commit is contained in:
parent
bffe34fe0a
commit
790b9cbc13
2 changed files with 8 additions and 5 deletions
|
@ -107,7 +107,7 @@ export class LoginViewModel extends ViewModel {
|
|||
|
||||
async attemptLogin(loginMethod) {
|
||||
this._setBusy(true);
|
||||
this._sessionContainer.startWithLogin(loginMethod);
|
||||
this._sessionContainer.startWithLogin(loginMethod, {inspectAccountSetup: true});
|
||||
const loadStatus = this._sessionContainer.loadStatus;
|
||||
const handle = loadStatus.waitFor(status => status !== LoadStatus.Login);
|
||||
await handle.promise;
|
||||
|
|
|
@ -131,7 +131,7 @@ export class SessionContainer {
|
|||
});
|
||||
}
|
||||
|
||||
async startWithLogin(loginMethod) {
|
||||
async startWithLogin(loginMethod, {inspectAccountSetup} = {}) {
|
||||
const currentStatus = this._status.get();
|
||||
if (currentStatus !== LoadStatus.LoginFailed &&
|
||||
currentStatus !== LoadStatus.NotLoading &&
|
||||
|
@ -176,10 +176,13 @@ export class SessionContainer {
|
|||
}
|
||||
return;
|
||||
}
|
||||
const dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, log);
|
||||
let dehydratedDevice;
|
||||
if (inspectAccountSetup) {
|
||||
dehydratedDevice = await this._inspectAccountAfterLogin(sessionInfo, log);
|
||||
if (dehydratedDevice) {
|
||||
sessionInfo.deviceId = dehydratedDevice.deviceId;
|
||||
}
|
||||
}
|
||||
await this._platform.sessionInfoStorage.add(sessionInfo);
|
||||
// loading the session can only lead to
|
||||
// LoadStatus.Error in case of an error,
|
||||
|
|
Loading…
Reference in a new issue