Temporarily fixes CORS header issue while logging in
authorunknown <ajbura@gmail.com>
Thu, 29 Jul 2021 08:23:50 +0000 (13:53 +0530)
committerunknown <ajbura@gmail.com>
Thu, 29 Jul 2021 08:23:50 +0000 (13:53 +0530)
src/client/action/auth.js

index 170fb4b720a7ca29a97b4b8489f1a1c7772e2a05..0403ec9f481af392feea198857cc885688945d26 100644 (file)
@@ -3,7 +3,12 @@ import cons from '../state/cons';
 import { getBaseUrl } from '../../util/matrixUtil';
 
 async function login(username, homeserver, password) {
-  const baseUrl = await getBaseUrl(homeserver);
+  let baseUrl = null;
+  try {
+    baseUrl = await getBaseUrl(homeserver);
+  } catch (e) {
+    baseUrl = `https://${homeserver}`;
+  }
 
   if (typeof baseUrl === 'undefined') throw new Error('Homeserver not found');