mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2025-12-10 03:34:56 +00:00
Allow fixed homeserver (#142)
This commit is contained in:
parent
3ea1f51eb5
commit
e19c34324b
4 changed files with 20 additions and 3 deletions
|
|
@ -82,6 +82,7 @@ const LoginPage = ({ theme }) => {
|
|||
const setLocale = useSetLocale();
|
||||
const translate = useTranslate();
|
||||
const base_url = localStorage.getItem("base_url");
|
||||
const cfg_base_url = process.env.REACT_APP_SERVER;
|
||||
|
||||
const renderInput = ({
|
||||
meta: { touched, error } = {},
|
||||
|
|
@ -149,7 +150,7 @@ const LoginPage = ({ theme }) => {
|
|||
const [serverVersion, setServerVersion] = useState("");
|
||||
|
||||
const handleUsernameChange = _ => {
|
||||
if (formData.base_url) return;
|
||||
if (formData.base_url || cfg_base_url) return;
|
||||
// check if username is a full qualified userId then set base_url accordially
|
||||
const home_server = extractHomeServer(formData.username);
|
||||
const wellKnownUrl = `https://${home_server}/.well-known/matrix/client`;
|
||||
|
|
@ -201,6 +202,7 @@ const LoginPage = ({ theme }) => {
|
|||
label={translate("ra.auth.username")}
|
||||
disabled={loading}
|
||||
onBlur={handleUsernameChange}
|
||||
resettable
|
||||
fullWidth
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -211,6 +213,7 @@ const LoginPage = ({ theme }) => {
|
|||
label={translate("ra.auth.password")}
|
||||
type="password"
|
||||
disabled={loading}
|
||||
resettable
|
||||
fullWidth
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -219,7 +222,8 @@ const LoginPage = ({ theme }) => {
|
|||
name="base_url"
|
||||
component={renderInput}
|
||||
label={translate("synapseadmin.auth.base_url")}
|
||||
disabled={loading}
|
||||
disabled={cfg_base_url || loading}
|
||||
resettable
|
||||
fullWidth
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -230,7 +234,7 @@ const LoginPage = ({ theme }) => {
|
|||
|
||||
return (
|
||||
<Form
|
||||
initialValues={{ base_url: base_url }}
|
||||
initialValues={{ base_url: cfg_base_url || base_url }}
|
||||
onSubmit={handleSubmit}
|
||||
validate={validate}
|
||||
render={({ handleSubmit }) => (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue