From fa2e2bc8f33b0af8b0a649f8a9cc2e25c182a5b8 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 20 Jan 2022 12:34:36 +0530 Subject: [PATCH] Allow register without providing username --- src/matrix/net/HomeServerApi.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index 606514ae..62008087 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -165,19 +165,20 @@ export class HomeServerApi { return this._unauthedRequest("GET", this._url("/login")); } - register(username: string, password: string, initialDeviceDisplayName: string, auth?: Record, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest { + register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest { // todo: This is so that we disable cache-buster because it would cause the hs to respond with error // see https://github.com/matrix-org/synapse/issues/7722 // need to this about the implications of this later const _options = options ?? {}; Object.assign(_options, { cache: true }); + const _username = username ?? undefined; return this._unauthedRequest( "POST", this._url("/register", CS_V3_PREFIX), undefined, { auth, - username, + _username, password, initial_device_displayname: initialDeviceDisplayName, inhibit_login: inhibitLogin ?? false,