diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 92acbb1..f6a8318 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: etke9 + etke_version: etke10 bunny_version: v0.1.0 base_path: ./ permissions: diff --git a/README.md b/README.md index 8adf2eb..25c36b5 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ The following changes are already implemented: * Switch from nginx to [SWS](https://static-web-server.net/) for serving the app, reducing the size of the Docker image * [Fix redirect URL after user creation](https://github.com/etkecc/synapse-admin/pull/16) * [Display actual Synapse errors](https://github.com/etkecc/synapse-admin/pull/17) +* [Fix base_url being undefined on unsuccessful login](https://github.com/etkecc/synapse-admin/pull/18) _the list will be updated as new changes are added_ diff --git a/src/pages/LoginPage.tsx b/src/pages/LoginPage.tsx index 04cba25..a2e6cfa 100644 --- a/src/pages/LoginPage.tsx +++ b/src/pages/LoginPage.tsx @@ -168,7 +168,9 @@ const LoginPage = () => { const [matrixVersions, setMatrixVersions] = useState(""); const handleUsernameChange = () => { - if (formData.base_url || allowSingleBaseUrl) return; + if (formData.base_url || allowSingleBaseUrl) { + return; + } // check if username is a full qualified userId then set base_url accordingly const domain = splitMxid(formData.username)?.domain; if (domain) { @@ -180,6 +182,9 @@ const LoginPage = () => { }; useEffect(() => { + if (!formData.base_url) { + form.setValue("base_url", ""); + } if (formData.base_url === "" && allowMultipleBaseUrls) { form.setValue("base_url", restrictBaseUrl[0]); } diff --git a/src/synapse/authProvider.ts b/src/synapse/authProvider.ts index d221021..438334c 100644 --- a/src/synapse/authProvider.ts +++ b/src/synapse/authProvider.ts @@ -48,7 +48,7 @@ const authProvider: AuthProvider = { if (!base_url) { // there is some kind of bug with base_url being present in the form, but not submitted // ref: https://github.com/etkecc/synapse-admin/issues/14 - localStorage.removeItem("base_url") + storage.removeItem("base_url") throw new Error("Homeserver URL is required."); } base_url = base_url.replace(/\/+$/g, "");