WIP: Extract process.env
Change-Id: I9efb1079c0c88e6e0272c5fda734a367aa8f84a3
This commit is contained in:
parent
8688ab7d0e
commit
8c1546cd5a
@ -24,6 +24,8 @@ import frenchMessages from "./i18n/fr";
|
||||
import chineseMessages from "./i18n/zh";
|
||||
import italianMessages from "./i18n/it";
|
||||
|
||||
const fixed_base_url = undefined; // FIXME: process.env.REACT_APP_SERVER;
|
||||
|
||||
// TODO: Can we use lazy loading together with browser locale?
|
||||
const messages = {
|
||||
de: germanMessages,
|
||||
@ -42,7 +44,7 @@ const App = () => (
|
||||
disableTelemetry
|
||||
requireAuth
|
||||
loginPage={LoginPage}
|
||||
authProvider={authProvider}
|
||||
authProvider={authProvider(fixed_base_url)}
|
||||
dataProvider={dataProvider}
|
||||
i18nProvider={i18nProvider}
|
||||
>
|
||||
|
@ -81,7 +81,7 @@ const FormBox = styled(Box)(({ theme }) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const LoginPage = () => {
|
||||
const LoginPage = ({ cfg_base_url }) => {
|
||||
const login = useLogin();
|
||||
const notify = useNotify();
|
||||
const [loading, setLoading] = useState(false);
|
||||
@ -89,7 +89,6 @@ const LoginPage = () => {
|
||||
const [locale, setLocale] = useLocaleState();
|
||||
const translate = useTranslate();
|
||||
const base_url = localStorage.getItem("base_url");
|
||||
const cfg_base_url = process.env.REACT_APP_SERVER;
|
||||
const [ssoBaseUrl, setSSOBaseUrl] = useState("");
|
||||
const loginToken = /\?loginToken=([a-zA-Z0-9_-]+)/.exec(window.location.href);
|
||||
|
||||
@ -247,7 +246,7 @@ const LoginPage = () => {
|
||||
name="base_url"
|
||||
component={renderInput}
|
||||
label="synapseadmin.auth.base_url"
|
||||
disabled={cfg_base_url || loading}
|
||||
disabled={cfg_base_url != null || loading}
|
||||
resettable
|
||||
fullWidth
|
||||
className="input"
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { fetchUtils } from "react-admin";
|
||||
|
||||
const authProvider = {
|
||||
const authProvider = fixed_base_url => ({
|
||||
// called when the user attempts to log in
|
||||
login: ({ base_url, username, password, loginToken }) => {
|
||||
// force homeserver for protection in case the form is manipulated
|
||||
base_url = process.env.REACT_APP_SERVER || base_url;
|
||||
base_url = fixed_base_url || base_url;
|
||||
|
||||
console.log("login ");
|
||||
const options = {
|
||||
@ -86,6 +86,6 @@ const authProvider = {
|
||||
},
|
||||
// called when the user navigates to a new location, to check for permissions / roles
|
||||
getPermissions: () => Promise.resolve(),
|
||||
};
|
||||
});
|
||||
|
||||
export default authProvider;
|
||||
|
Loading…
Reference in New Issue
Block a user