Merge pull request #1199 from vector-im/SimonBrandner/feat/eula-config
This commit is contained in:
commit
e194d56894
7 changed files with 24 additions and 17 deletions
|
@ -4,5 +4,6 @@
|
||||||
"base_url": "https://call.ems.host",
|
"base_url": "https://call.ems.host",
|
||||||
"server_name": "call.ems.host"
|
"server_name": "call.ems.host"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"eula": "https://static.element.io/legal/online-EULA.pdf"
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,7 @@ export const RegisterPage: FC = () => {
|
||||||
const [error, setError] = useState<Error>();
|
const [error, setError] = useState<Error>();
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [passwordConfirmation, setPasswordConfirmation] = useState("");
|
const [passwordConfirmation, setPasswordConfirmation] = useState("");
|
||||||
const [privacyPolicyUrl, recaptchaKey, register] =
|
const { recaptchaKey, register } = useInteractiveRegistration();
|
||||||
useInteractiveRegistration();
|
|
||||||
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
||||||
|
|
||||||
const onSubmitRegisterForm = useCallback(
|
const onSubmitRegisterForm = useCallback(
|
||||||
|
@ -211,7 +210,7 @@ export const RegisterPage: FC = () => {
|
||||||
apply.
|
apply.
|
||||||
<br />
|
<br />
|
||||||
By clicking "Register", you agree to our{" "}
|
By clicking "Register", you agree to our{" "}
|
||||||
<Link href={privacyPolicyUrl}>
|
<Link href={Config.get().eula}>
|
||||||
End User Licensing Agreement (EULA)
|
End User Licensing Agreement (EULA)
|
||||||
</Link>
|
</Link>
|
||||||
</Trans>
|
</Trans>
|
||||||
|
|
|
@ -22,17 +22,17 @@ import { initClient } from "../matrix-utils";
|
||||||
import { Session } from "../ClientContext";
|
import { Session } from "../ClientContext";
|
||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
|
|
||||||
export const useInteractiveRegistration = (): [
|
export const useInteractiveRegistration = (): {
|
||||||
string,
|
privacyPolicyUrl: string;
|
||||||
string,
|
recaptchaKey: string;
|
||||||
(
|
register: (
|
||||||
username: string,
|
username: string,
|
||||||
password: string,
|
password: string,
|
||||||
displayName: string,
|
displayName: string,
|
||||||
recaptchaResponse: string,
|
recaptchaResponse: string,
|
||||||
passwordlessUser?: boolean
|
passwordlessUser?: boolean
|
||||||
) => Promise<[MatrixClient, Session]>
|
) => Promise<[MatrixClient, Session]>;
|
||||||
] => {
|
} => {
|
||||||
const [privacyPolicyUrl, setPrivacyPolicyUrl] = useState<string>();
|
const [privacyPolicyUrl, setPrivacyPolicyUrl] = useState<string>();
|
||||||
const [recaptchaKey, setRecaptchaKey] = useState<string>();
|
const [recaptchaKey, setRecaptchaKey] = useState<string>();
|
||||||
|
|
||||||
|
@ -126,5 +126,5 @@ export const useInteractiveRegistration = (): [
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return [privacyPolicyUrl, recaptchaKey, register];
|
return { privacyPolicyUrl, recaptchaKey, register };
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ interface UseRegisterPasswordlessUserType {
|
||||||
|
|
||||||
export function useRegisterPasswordlessUser(): UseRegisterPasswordlessUserType {
|
export function useRegisterPasswordlessUser(): UseRegisterPasswordlessUserType {
|
||||||
const { setClient } = useClient();
|
const { setClient } = useClient();
|
||||||
const [privacyPolicyUrl, recaptchaKey, register] =
|
const { privacyPolicyUrl, recaptchaKey, register } =
|
||||||
useInteractiveRegistration();
|
useInteractiveRegistration();
|
||||||
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,11 @@ export interface ConfigOptions {
|
||||||
features?: {
|
features?: {
|
||||||
feature_group_calls_without_video_and_audio: boolean;
|
feature_group_calls_without_video_and_audio: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to the end-user license agreement (EULA)
|
||||||
|
*/
|
||||||
|
eula: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overrides members from ConfigOptions that are always provided by the
|
// Overrides members from ConfigOptions that are always provided by the
|
||||||
|
@ -86,4 +91,5 @@ export const DEFAULT_CONFIG: ResolvedConfigOptions = {
|
||||||
server_name: "localhost",
|
server_name: "localhost",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
eula: "https://static.element.io/legal/online-EULA.pdf",
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,7 @@ import commonStyles from "./common.module.css";
|
||||||
import { generateRandomName } from "../auth/generateRandomName";
|
import { generateRandomName } from "../auth/generateRandomName";
|
||||||
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
import { AnalyticsNotice } from "../analytics/AnalyticsNotice";
|
||||||
import { useOptInAnalytics } from "../settings/useSetting";
|
import { useOptInAnalytics } from "../settings/useSetting";
|
||||||
|
import { Config } from "../config/Config";
|
||||||
import { E2EEBanner } from "../E2EEBanner";
|
import { E2EEBanner } from "../E2EEBanner";
|
||||||
|
|
||||||
export const UnauthenticatedView: FC = () => {
|
export const UnauthenticatedView: FC = () => {
|
||||||
|
@ -49,8 +50,7 @@ export const UnauthenticatedView: FC = () => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState<Error>();
|
const [error, setError] = useState<Error>();
|
||||||
const [optInAnalytics] = useOptInAnalytics();
|
const [optInAnalytics] = useOptInAnalytics();
|
||||||
const [privacyPolicyUrl, recaptchaKey, register] =
|
const { recaptchaKey, register } = useInteractiveRegistration();
|
||||||
useInteractiveRegistration();
|
|
||||||
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
||||||
|
|
||||||
const { modalState, modalProps } = useModalTriggerState();
|
const { modalState, modalProps } = useModalTriggerState();
|
||||||
|
@ -166,7 +166,7 @@ export const UnauthenticatedView: FC = () => {
|
||||||
<Caption className={styles.notice}>
|
<Caption className={styles.notice}>
|
||||||
<Trans>
|
<Trans>
|
||||||
By clicking "Go", you agree to our{" "}
|
By clicking "Go", you agree to our{" "}
|
||||||
<Link href={privacyPolicyUrl}>
|
<Link href={Config.get().eula}>
|
||||||
End User Licensing Agreement (EULA)
|
End User Licensing Agreement (EULA)
|
||||||
</Link>
|
</Link>
|
||||||
</Trans>
|
</Trans>
|
||||||
|
|
|
@ -26,12 +26,13 @@ import { FieldRow, InputField, ErrorMessage } from "../input/Input";
|
||||||
import { Form } from "../form/Form";
|
import { Form } from "../form/Form";
|
||||||
import { UserMenuContainer } from "../UserMenuContainer";
|
import { UserMenuContainer } from "../UserMenuContainer";
|
||||||
import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser";
|
import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser";
|
||||||
|
import { Config } from "../config/Config";
|
||||||
|
|
||||||
export function RoomAuthView() {
|
export function RoomAuthView() {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState<Error>();
|
const [error, setError] = useState<Error>();
|
||||||
|
|
||||||
const { registerPasswordlessUser, recaptchaId, privacyPolicyUrl } =
|
const { registerPasswordlessUser, recaptchaId } =
|
||||||
useRegisterPasswordlessUser();
|
useRegisterPasswordlessUser();
|
||||||
|
|
||||||
const onSubmit = useCallback(
|
const onSubmit = useCallback(
|
||||||
|
@ -83,7 +84,7 @@ export function RoomAuthView() {
|
||||||
<Caption>
|
<Caption>
|
||||||
<Trans>
|
<Trans>
|
||||||
By clicking "Join call now", you agree to our{" "}
|
By clicking "Join call now", you agree to our{" "}
|
||||||
<Link href={privacyPolicyUrl}>
|
<Link href={Config.get().eula}>
|
||||||
End User Licensing Agreement (EULA)
|
End User Licensing Agreement (EULA)
|
||||||
</Link>
|
</Link>
|
||||||
</Trans>
|
</Trans>
|
||||||
|
|
Loading…
Reference in a new issue