correctly treat empty or "almost empty" restrictBaseUrl config option, fixes #56

This commit is contained in:
Aine 2024-10-07 12:00:33 +03:00
parent a42efe7eda
commit f5d6f24b30
No known key found for this signature in database
GPG key ID: 34969C908CCA2804

View file

@ -88,7 +88,7 @@ const LoginPage = () => {
const notify = useNotify(); const notify = useNotify();
const { restrictBaseUrl } = useAppContext(); const { restrictBaseUrl } = useAppContext();
const allowSingleBaseUrl = typeof restrictBaseUrl === "string"; const allowSingleBaseUrl = typeof restrictBaseUrl === "string";
const allowMultipleBaseUrls = Array.isArray(restrictBaseUrl); const allowMultipleBaseUrls = (Array.isArray(restrictBaseUrl) && restrictBaseUrl.length > 0 && restrictBaseUrl[0] !== "" && restrictBaseUrl[0] !== null);
const allowAnyBaseUrl = !(allowSingleBaseUrl || allowMultipleBaseUrls); const allowAnyBaseUrl = !(allowSingleBaseUrl || allowMultipleBaseUrls);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [supportPassAuth, setSupportPassAuth] = useState(true); const [supportPassAuth, setSupportPassAuth] = useState(true);