diff --git a/config/config.sample.json b/config/config.sample.json index 7afb8f6..35ad184 100644 --- a/config/config.sample.json +++ b/config/config.sample.json @@ -4,5 +4,6 @@ "base_url": "https://call.ems.host", "server_name": "call.ems.host" } - } + }, + "eula": "https://static.element.io/legal/online-EULA.pdf" } diff --git a/src/auth/RegisterPage.tsx b/src/auth/RegisterPage.tsx index 1fd3911..c96dea2 100644 --- a/src/auth/RegisterPage.tsx +++ b/src/auth/RegisterPage.tsx @@ -54,8 +54,7 @@ export const RegisterPage: FC = () => { const [error, setError] = useState(); const [password, setPassword] = useState(""); const [passwordConfirmation, setPasswordConfirmation] = useState(""); - const [privacyPolicyUrl, recaptchaKey, register] = - useInteractiveRegistration(); + const { recaptchaKey, register } = useInteractiveRegistration(); const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey); const onSubmitRegisterForm = useCallback( @@ -211,7 +210,7 @@ export const RegisterPage: FC = () => { apply.
By clicking "Register", you agree to our{" "} - + End User Licensing Agreement (EULA) diff --git a/src/auth/useInteractiveRegistration.ts b/src/auth/useInteractiveRegistration.ts index 156842b..2db3377 100644 --- a/src/auth/useInteractiveRegistration.ts +++ b/src/auth/useInteractiveRegistration.ts @@ -22,17 +22,17 @@ import { initClient } from "../matrix-utils"; import { Session } from "../ClientContext"; import { Config } from "../config/Config"; -export const useInteractiveRegistration = (): [ - string, - string, - ( +export const useInteractiveRegistration = (): { + privacyPolicyUrl: string; + recaptchaKey: string; + register: ( username: string, password: string, displayName: string, recaptchaResponse: string, passwordlessUser?: boolean - ) => Promise<[MatrixClient, Session]> -] => { + ) => Promise<[MatrixClient, Session]>; +} => { const [privacyPolicyUrl, setPrivacyPolicyUrl] = useState(); const [recaptchaKey, setRecaptchaKey] = useState(); @@ -126,5 +126,5 @@ export const useInteractiveRegistration = (): [ [] ); - return [privacyPolicyUrl, recaptchaKey, register]; + return { privacyPolicyUrl, recaptchaKey, register }; }; diff --git a/src/auth/useRegisterPasswordlessUser.ts b/src/auth/useRegisterPasswordlessUser.ts index d780e99..94d40cd 100644 --- a/src/auth/useRegisterPasswordlessUser.ts +++ b/src/auth/useRegisterPasswordlessUser.ts @@ -30,7 +30,7 @@ interface UseRegisterPasswordlessUserType { export function useRegisterPasswordlessUser(): UseRegisterPasswordlessUserType { const { setClient } = useClient(); - const [privacyPolicyUrl, recaptchaKey, register] = + const { privacyPolicyUrl, recaptchaKey, register } = useInteractiveRegistration(); const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey); diff --git a/src/config/ConfigOptions.ts b/src/config/ConfigOptions.ts index f878ec5..cbbc107 100644 --- a/src/config/ConfigOptions.ts +++ b/src/config/ConfigOptions.ts @@ -66,6 +66,11 @@ export interface ConfigOptions { features?: { 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 @@ -86,4 +91,5 @@ export const DEFAULT_CONFIG: ResolvedConfigOptions = { server_name: "localhost", }, }, + eula: "https://static.element.io/legal/online-EULA.pdf", }; diff --git a/src/home/UnauthenticatedView.tsx b/src/home/UnauthenticatedView.tsx index 32877e4..25da76f 100644 --- a/src/home/UnauthenticatedView.tsx +++ b/src/home/UnauthenticatedView.tsx @@ -41,6 +41,7 @@ import commonStyles from "./common.module.css"; import { generateRandomName } from "../auth/generateRandomName"; import { AnalyticsNotice } from "../analytics/AnalyticsNotice"; import { useOptInAnalytics } from "../settings/useSetting"; +import { Config } from "../config/Config"; export const UnauthenticatedView: FC = () => { const { setClient } = useClient(); @@ -48,8 +49,7 @@ export const UnauthenticatedView: FC = () => { const [loading, setLoading] = useState(false); const [error, setError] = useState(); const [optInAnalytics] = useOptInAnalytics(); - const [privacyPolicyUrl, recaptchaKey, register] = - useInteractiveRegistration(); + const { recaptchaKey, register } = useInteractiveRegistration(); const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey); const { modalState, modalProps } = useModalTriggerState(); @@ -165,7 +165,7 @@ export const UnauthenticatedView: FC = () => { By clicking "Go", you agree to our{" "} - + End User Licensing Agreement (EULA) diff --git a/src/room/RoomAuthView.tsx b/src/room/RoomAuthView.tsx index e12013e..8a50d31 100644 --- a/src/room/RoomAuthView.tsx +++ b/src/room/RoomAuthView.tsx @@ -26,12 +26,13 @@ import { FieldRow, InputField, ErrorMessage } from "../input/Input"; import { Form } from "../form/Form"; import { UserMenuContainer } from "../UserMenuContainer"; import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser"; +import { Config } from "../config/Config"; export function RoomAuthView() { const [loading, setLoading] = useState(false); const [error, setError] = useState(); - const { registerPasswordlessUser, recaptchaId, privacyPolicyUrl } = + const { registerPasswordlessUser, recaptchaId } = useRegisterPasswordlessUser(); const onSubmit = useCallback( @@ -83,7 +84,7 @@ export function RoomAuthView() { By clicking "Join call now", you agree to our{" "} - + End User Licensing Agreement (EULA)