mirror of
https://github.com/etkecc/synapse-admin.git
synced 2025-02-17 20:09:48 +03:00
Fix base_url being undefined on unsuccessful login (#18)
* Fix base_url being undefined on unsuccessful login * update readme
This commit is contained in:
parent
390aab5ce7
commit
e093bd8625
4 changed files with 9 additions and 3 deletions
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
|
@ -4,7 +4,7 @@ on:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
env:
|
env:
|
||||||
upstream_version: v0.10.3
|
upstream_version: v0.10.3
|
||||||
etke_version: etke9
|
etke_version: etke10
|
||||||
bunny_version: v0.1.0
|
bunny_version: v0.1.0
|
||||||
base_path: ./
|
base_path: ./
|
||||||
permissions:
|
permissions:
|
||||||
|
|
|
@ -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
|
* 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)
|
* [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)
|
* [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_
|
_the list will be updated as new changes are added_
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,9 @@ const LoginPage = () => {
|
||||||
const [matrixVersions, setMatrixVersions] = useState("");
|
const [matrixVersions, setMatrixVersions] = useState("");
|
||||||
|
|
||||||
const handleUsernameChange = () => {
|
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
|
// check if username is a full qualified userId then set base_url accordingly
|
||||||
const domain = splitMxid(formData.username)?.domain;
|
const domain = splitMxid(formData.username)?.domain;
|
||||||
if (domain) {
|
if (domain) {
|
||||||
|
@ -180,6 +182,9 @@ const LoginPage = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!formData.base_url) {
|
||||||
|
form.setValue("base_url", "");
|
||||||
|
}
|
||||||
if (formData.base_url === "" && allowMultipleBaseUrls) {
|
if (formData.base_url === "" && allowMultipleBaseUrls) {
|
||||||
form.setValue("base_url", restrictBaseUrl[0]);
|
form.setValue("base_url", restrictBaseUrl[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ const authProvider: AuthProvider = {
|
||||||
if (!base_url) {
|
if (!base_url) {
|
||||||
// there is some kind of bug with base_url being present in the form, but not submitted
|
// 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
|
// ref: https://github.com/etkecc/synapse-admin/issues/14
|
||||||
localStorage.removeItem("base_url")
|
storage.removeItem("base_url")
|
||||||
throw new Error("Homeserver URL is required.");
|
throw new Error("Homeserver URL is required.");
|
||||||
}
|
}
|
||||||
base_url = base_url.replace(/\/+$/g, "");
|
base_url = base_url.replace(/\/+$/g, "");
|
||||||
|
|
Loading…
Add table
Reference in a new issue