mirror of
https://github.com/vector-im/element-call.git
synced 2026-09-22 22:29:30 +00:00
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:
co-authored by
Claude Fable 5.1
parent
302f6f7efa
commit
a7fdade61a
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user