Fix base_url being undefined on unsuccessful login (#18)

* Fix base_url being undefined on unsuccessful login

* update readme
This commit is contained in:
Borislav Pantaleev
2024-09-05 23:23:17 +03:00
committed by GitHub
parent 390aab5ce7
commit e093bd8625
4 changed files with 9 additions and 3 deletions

View File

@@ -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]);
}