forked from mystiq/hydrogen-web
Copy over username only if it exists
This commit is contained in:
parent
792d5c62c5
commit
420c12f202
1 changed files with 11 additions and 15 deletions
|
@ -168,23 +168,19 @@ export class HomeServerApi {
|
||||||
register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record<string, any>, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest {
|
register(username: string | null, password: string, initialDeviceDisplayName: string, auth?: Record<string, any>, inhibitLogin?: boolean , options?: IRequestOptions): IHomeServerRequest {
|
||||||
// todo: This is so that we disable cache-buster because it would cause the hs to respond with error
|
// 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
|
// see https://github.com/matrix-org/synapse/issues/7722
|
||||||
// need to this about the implications of this later
|
|
||||||
const _options = options ?? {};
|
const _options = options ?? {};
|
||||||
Object.assign(_options, { cache: true });
|
Object.assign(_options, { cache: true });
|
||||||
const _username = username ?? undefined;
|
const body = {
|
||||||
return this._unauthedRequest(
|
auth,
|
||||||
"POST",
|
password,
|
||||||
this._url("/register", CS_V3_PREFIX),
|
initial_device_displayname: initialDeviceDisplayName,
|
||||||
undefined,
|
inhibit_login: inhibitLogin ?? false,
|
||||||
{
|
};
|
||||||
auth,
|
if (username) {
|
||||||
_username,
|
// username is optional for registration
|
||||||
password,
|
Object.assign(body, { username });
|
||||||
initial_device_displayname: initialDeviceDisplayName,
|
}
|
||||||
inhibit_login: inhibitLogin ?? false,
|
return this._unauthedRequest( "POST", this._url("/register", CS_V3_PREFIX), undefined, body, _options);
|
||||||
},
|
|
||||||
_options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordLogin(username: string, password: string, initialDeviceDisplayName: string, options?: IRequestOptions): IHomeServerRequest {
|
passwordLogin(username: string, password: string, initialDeviceDisplayName: string, options?: IRequestOptions): IHomeServerRequest {
|
||||||
|
|
Loading…
Reference in a new issue