Apply suggestions, rename var
This commit is contained in:
parent
bcb15faf42
commit
a24b5e7988
@ -82,7 +82,7 @@ const LoginPage = ({ theme }) => {
|
|||||||
const setLocale = useSetLocale();
|
const setLocale = useSetLocale();
|
||||||
const translate = useTranslate();
|
const translate = useTranslate();
|
||||||
const base_url = localStorage.getItem("base_url");
|
const base_url = localStorage.getItem("base_url");
|
||||||
const override_server = process.env.REACT_APP_SERVER;
|
const cfg_base_url = process.env.REACT_APP_SERVER;
|
||||||
|
|
||||||
const renderInput = ({
|
const renderInput = ({
|
||||||
meta: { touched, error } = {},
|
meta: { touched, error } = {},
|
||||||
@ -150,7 +150,7 @@ const LoginPage = ({ theme }) => {
|
|||||||
const [serverVersion, setServerVersion] = useState("");
|
const [serverVersion, setServerVersion] = useState("");
|
||||||
|
|
||||||
const handleUsernameChange = _ => {
|
const handleUsernameChange = _ => {
|
||||||
if (formData.base_url || override_server) return;
|
if (formData.base_url || cfg_base_url) return;
|
||||||
// check if username is a full qualified userId then set base_url accordially
|
// check if username is a full qualified userId then set base_url accordially
|
||||||
const home_server = extractHomeServer(formData.username);
|
const home_server = extractHomeServer(formData.username);
|
||||||
const wellKnownUrl = `https://${home_server}/.well-known/matrix/client`;
|
const wellKnownUrl = `https://${home_server}/.well-known/matrix/client`;
|
||||||
@ -222,7 +222,7 @@ const LoginPage = ({ theme }) => {
|
|||||||
name="base_url"
|
name="base_url"
|
||||||
component={renderInput}
|
component={renderInput}
|
||||||
label={translate("synapseadmin.auth.base_url")}
|
label={translate("synapseadmin.auth.base_url")}
|
||||||
disabled={override_server ? true : loading}
|
disabled={cfg_base_url || loading}
|
||||||
resettable
|
resettable
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
@ -234,7 +234,7 @@ const LoginPage = ({ theme }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
initialValues={{ base_url: override_server ? override_server : base_url }}
|
initialValues={{ base_url: cfg_base_url || base_url }}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
render={({ handleSubmit }) => (
|
render={({ handleSubmit }) => (
|
||||||
|
@ -4,9 +4,7 @@ const authProvider = {
|
|||||||
// called when the user attempts to log in
|
// called when the user attempts to log in
|
||||||
login: ({ base_url, username, password }) => {
|
login: ({ base_url, username, password }) => {
|
||||||
// force homeserver for protection in case the form is manipulated
|
// force homeserver for protection in case the form is manipulated
|
||||||
base_url = process.env.REACT_APP_SERVER
|
base_url = process.env.REACT_APP_SERVER || base_url;
|
||||||
? process.env.REACT_APP_SERVER
|
|
||||||
: base_url;
|
|
||||||
|
|
||||||
console.log("login ");
|
console.log("login ");
|
||||||
const options = {
|
const options = {
|
||||||
|
Loading…
Reference in New Issue
Block a user