From 7747dc7f2858e1b34944bce0eda5606df3fe9294 Mon Sep 17 00:00:00 2001 From: Aine Date: Tue, 3 Sep 2024 10:40:27 +0300 Subject: [PATCH] Add identifier when authorizing with password This PR is almost copy of https://github.com/Awesome-Technologies/synapse-admin/pull/601 PR, authored by @dklimpel --- .github/workflows/workflow.yml | 2 +- README.md | 1 + src/synapse/authProvider.test.ts | 2 +- src/synapse/authProvider.ts | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 91aac62..89ba691 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -4,7 +4,7 @@ on: branches: [ "main" ] env: upstream_version: v0.10.3 - etke_version: etke2 + etke_version: etke3 bunny_version: v0.1.0 permissions: checks: write diff --git a/README.md b/README.md index 8fbf686..6dc9849 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The following changes are already implemented: * [Prevent admins from deleting themselves](https://github.com/etkecc/synapse-admin/pull/1) * [Fix user's default tab not being shown](https://github.com/etkecc/synapse-admin/pull/8) +* [Add identifier when authorizing with password](https://github.com/Awesome-Technologies/synapse-admin/pull/601) _the list will be updated as new changes are added_ diff --git a/src/synapse/authProvider.test.ts b/src/synapse/authProvider.test.ts index bf5103b..ad61500 100644 --- a/src/synapse/authProvider.test.ts +++ b/src/synapse/authProvider.test.ts @@ -30,7 +30,7 @@ describe("authProvider", () => { expect(ret).toBe(undefined); expect(fetch).toBeCalledWith("http://example.com/_matrix/client/r0/login", { - body: '{"device_id":null,"initial_device_display_name":"Synapse Admin","type":"m.login.password","user":"@user:example.com","password":"secret"}', + body: '{"device_id":null,"initial_device_display_name":"Synapse Admin","type":"m.login.password","identifier":{"type":"m.id.user","user":"@user:example.com"},"password":"secret"}', headers: new Headers({ Accept: "application/json", "Content-Type": "application/json", diff --git a/src/synapse/authProvider.ts b/src/synapse/authProvider.ts index 5bc7d87..2134ee2 100644 --- a/src/synapse/authProvider.ts +++ b/src/synapse/authProvider.ts @@ -31,7 +31,10 @@ const authProvider: AuthProvider = { } : { type: "m.login.password", - user: username, + identifier: { + type: "m.id.user", + user: username, + }, password: password, } )