1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-05 00:42:10 +03:00

Fix registration check your emails stage regression (#3616)

* Fix registration check your emails stage regression

* Simplify diff

* Add test
This commit is contained in:
Michael Telatynski
2023-07-24 15:08:17 +01:00
committed by GitHub
parent 6b018b6927
commit 533c21a515
2 changed files with 48 additions and 4 deletions

View File

@@ -264,8 +264,8 @@ export class InteractiveAuth<T> {
private readonly requestEmailTokenCallback: IOpts<T>["requestEmailToken"];
private readonly supportedStages?: Set<string>;
// The current latest data received from the server during the user interactive auth flow.
private data: IAuthData;
// The current latest data or error received from the server during the user interactive auth flow.
private data: IAuthData & MatrixError["data"];
private emailSid?: string;
private requestingEmailToken = false;
private attemptAuthDeferred: IDeferred<T> | null = null;
@@ -549,7 +549,7 @@ export class InteractiveAuth<T> {
matrixError.data.session = (this.data as IAuthData).session;
}
if (matrixError) {
this.data = matrixError.data as IAuthData;
this.data = matrixError.data;
}
try {
this.startNextAuthStage();
@@ -602,6 +602,14 @@ export class InteractiveAuth<T> {
return;
}
if (this.data?.errcode || this.data?.error) {
this.stateUpdatedCallback(nextStage, {
errcode: this.data?.errcode || "",
error: this.data?.error || "",
});
return;
}
this.stateUpdatedCallback(nextStage, nextStage === EMAIL_STAGE_TYPE ? { emailSid: this.emailSid } : {});
}