Tolerate a registration flow that carries no params

`registerRequest({})` rejects with the registration flows, and a homeserver
may answer with no `params` at all, which threw a TypeError on the landing
and login screens and left them without a privacy policy link.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Quentin Gliech
2026-09-09 22:44:59 +02:00
co-authored by Claude Fable 5.1
parent 302f6f7efa
commit a7fdade61a
+7 -2
View File
@@ -50,11 +50,16 @@ export const useInteractiveRegistration = (
useEffect(() => {
if (isWidget) return;
// An empty registerRequest is used to get the privacy policy and recaptcha key.
// A 401 carrying the flow parameters is the expected answer, so this
// rejection is the success path, and some homeservers answer it with no
// params at all.
authClient.current!.registerRequest({}).catch((error) => {
logger.debug("Registration flow parameters", error);
setPrivacyPolicyUrl(
error.data?.params["m.login.terms"]?.policies?.privacy_policy?.en?.url,
error.data?.params?.["m.login.terms"]?.policies?.privacy_policy?.en
?.url,
);
setRecaptchaKey(error.data?.params["m.login.recaptcha"]?.public_key);
setRecaptchaKey(error.data?.params?.["m.login.recaptcha"]?.public_key);
});
}, [isWidget]);