From 792d5c62c52775d1b34fd73b4ed5ca7910ad059d Mon Sep 17 00:00:00 2001
From: RMidhunSuresh <hi@midhun.dev>
Date: Thu, 20 Jan 2022 12:35:11 +0530
Subject: [PATCH] Return username when registration is completed

---
 src/matrix/registration/stages/BaseRegistrationStage.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/matrix/registration/stages/BaseRegistrationStage.ts b/src/matrix/registration/stages/BaseRegistrationStage.ts
index 1458c554..4c15bb5e 100644
--- a/src/matrix/registration/stages/BaseRegistrationStage.ts
+++ b/src/matrix/registration/stages/BaseRegistrationStage.ts
@@ -43,10 +43,10 @@ export abstract class BaseRegistrationStage {
     /**
      * Finish a registration stage, return value is:
      * - the next stage if this stage was completed successfully
-     * - true if registration is completed
+     * - user-id (string) if registration is completed
      * - an error if something went wrong
      */
-    abstract complete(auth?: Auth): Promise<BaseRegistrationStage | Error | true>;
+    abstract complete(auth?: Auth): Promise<BaseRegistrationStage | Error | string>;
 
     setNextStage(stage: BaseRegistrationStage) {
         this._nextStage = stage;
@@ -55,7 +55,7 @@ export abstract class BaseRegistrationStage {
     parseResponse(response: RegistrationResponse) {
         if (response.user_id) {
             // registration completed successfully
-            return true;
+            return response.user_id;
         }
         else if (response.completed?.find(c => c === this.type)) {
             return this._nextStage;