Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
922fe5bafd |
@@ -56,7 +56,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 { recaptchaKey, register } = useInteractiveRegistration();
|
const { recaptchaKey, register } = useInteractiveRegistration(client);
|
||||||
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
const { execute, reset, recaptchaId } = useRecaptcha(recaptchaKey);
|
||||||
|
|
||||||
const onSubmitRegisterForm = useCallback(
|
const onSubmitRegisterForm = useCallback(
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ import { Session } from "../ClientContext";
|
|||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
import { widget } from "../widget";
|
import { widget } from "../widget";
|
||||||
|
|
||||||
export const useInteractiveRegistration = (): {
|
export const useInteractiveRegistration = (
|
||||||
|
oldClient?: MatrixClient,
|
||||||
|
): {
|
||||||
privacyPolicyUrl?: string;
|
privacyPolicyUrl?: string;
|
||||||
recaptchaKey?: string;
|
recaptchaKey?: string;
|
||||||
register: (
|
register: (
|
||||||
@@ -105,7 +107,7 @@ export const useInteractiveRegistration = (): {
|
|||||||
/* eslint-disable camelcase,@typescript-eslint/no-explicit-any */
|
/* eslint-disable camelcase,@typescript-eslint/no-explicit-any */
|
||||||
const { user_id, access_token, device_id } =
|
const { user_id, access_token, device_id } =
|
||||||
(await interactiveAuth.attemptAuth()) as any;
|
(await interactiveAuth.attemptAuth()) as any;
|
||||||
|
await oldClient?.logout(true);
|
||||||
const client = await initClient(
|
const client = await initClient(
|
||||||
{
|
{
|
||||||
baseUrl: Config.defaultHomeserverUrl()!,
|
baseUrl: Config.defaultHomeserverUrl()!,
|
||||||
@@ -136,7 +138,7 @@ export const useInteractiveRegistration = (): {
|
|||||||
|
|
||||||
return [client, session];
|
return [client, session];
|
||||||
},
|
},
|
||||||
[],
|
[oldClient],
|
||||||
);
|
);
|
||||||
|
|
||||||
return { privacyPolicyUrl, recaptchaKey, register };
|
return { privacyPolicyUrl, recaptchaKey, register };
|
||||||
|
|||||||
Reference in New Issue
Block a user