From bbb372a5a91d252f3ccb4f613c873ddc64e718e0 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 11:37:07 +0100 Subject: [PATCH 1/8] try manually clear any left over recaptcha overalys --- src/components/views/auth/CaptchaForm.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index 2b82f4cea0..8bfce1cb9c 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -63,6 +63,8 @@ export default class CaptchaForm extends React.Component 0) chaptchas[0].parentElement?.remove(); } // Borrowed directly from: https://github.com/codeep/react-recaptcha-google/commit/e118fa5670fa268426969323b2e7fe77698376ba From 63279b4dd31fd34b1f9fc6b92a70f817978b3623 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 12:09:01 +0100 Subject: [PATCH 2/8] add alert to debug webview --- src/components/views/auth/CaptchaForm.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index 8bfce1cb9c..bda4c6abf6 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -62,6 +62,7 @@ export default class CaptchaForm extends React.Component 0) chaptchas[0].parentElement?.remove(); From d0f8fd1f7aef4667c95e675cf0dd5cc9b43ebe76 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 12:33:49 +0100 Subject: [PATCH 3/8] disable settings check for netlify build --- src/components/structures/MatrixChat.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 8e0eaabe4f..a426d8a0a7 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -956,8 +956,7 @@ export default class MatrixChat extends React.PureComponent { this.showScreen("welcome"); return; } - const isMobileRegistrationAllowed = - isMobileRegistration && SettingsStore.getValue("Registration.mobileRegistrationHelper"); + const isMobileRegistrationAllowed = isMobileRegistration; //&& SettingsStore.getValue("Registration.mobileRegistrationHelper"); const newState: Partial = { view: Views.REGISTER, From 8255abf6e53d247da09b8df1a2e4757791dbdc17 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 14:47:05 +0100 Subject: [PATCH 4/8] Update fix for removing challenge, as g-recaptcha-bubble-arrow is now always shown --- src/components/views/auth/CaptchaForm.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index bda4c6abf6..83f27964f1 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -62,10 +62,18 @@ export default class CaptchaForm extends React.Component 0) chaptchas[0].parentElement?.remove(); + const iframes = document.querySelectorAll("iframe"); + for (const iframe of iframes) { + if (iframe.src.includes("https://www.recaptcha.net/recaptcha/api2/bframe")) { + let parentBeforeBody: HTMLElement | null = iframe; + do { + parentBeforeBody = parentBeforeBody.parentElement; + } while (parentBeforeBody?.parentElement && parentBeforeBody.parentElement != document.body); + parentBeforeBody?.remove(); + } + } } // Borrowed directly from: https://github.com/codeep/react-recaptcha-google/commit/e118fa5670fa268426969323b2e7fe77698376ba From 5be1e51bcee7139ba70897e68fc39ff7b0ebc6a8 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 15:28:24 +0100 Subject: [PATCH 5/8] Remove alert for debugging webview --- src/components/views/auth/CaptchaForm.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index 83f27964f1..ad9ef3e5e2 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -62,7 +62,6 @@ export default class CaptchaForm extends React.Component Date: Wed, 18 Sep 2024 15:29:06 +0100 Subject: [PATCH 6/8] Put back requirement for config setting and make sure it redirects to welcome if not present. --- src/components/structures/MatrixChat.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index a426d8a0a7..36905932f9 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -952,11 +952,13 @@ export default class MatrixChat extends React.PureComponent { } private async startRegistration(params: { [key: string]: string }, isMobileRegistration?: boolean): Promise { - if (!SettingsStore.getValue(UIFeature.Registration)) { + const isMobileRegistrationAllowed = + isMobileRegistration && SettingsStore.getValue("Registration.mobileRegistrationHelper"); + + if (!SettingsStore.getValue(UIFeature.Registration) || !isMobileRegistrationAllowed) { this.showScreen("welcome"); return; } - const isMobileRegistrationAllowed = isMobileRegistration; //&& SettingsStore.getValue("Registration.mobileRegistrationHelper"); const newState: Partial = { view: Views.REGISTER, From e044523d8fc5703a6d649d71ad81a9585ba3d154 Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 18 Sep 2024 15:35:21 +0100 Subject: [PATCH 7/8] Add comment to explain bodge. --- src/components/views/auth/CaptchaForm.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index ad9ef3e5e2..f216f004fd 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -63,6 +63,9 @@ export default class CaptchaForm extends React.Component Date: Wed, 18 Sep 2024 16:02:05 +0100 Subject: [PATCH 8/8] Remove unrelated code --- src/components/structures/MatrixChat.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 36905932f9..8e0eaabe4f 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -952,13 +952,12 @@ export default class MatrixChat extends React.PureComponent { } private async startRegistration(params: { [key: string]: string }, isMobileRegistration?: boolean): Promise { - const isMobileRegistrationAllowed = - isMobileRegistration && SettingsStore.getValue("Registration.mobileRegistrationHelper"); - - if (!SettingsStore.getValue(UIFeature.Registration) || !isMobileRegistrationAllowed) { + if (!SettingsStore.getValue(UIFeature.Registration)) { this.showScreen("welcome"); return; } + const isMobileRegistrationAllowed = + isMobileRegistration && SettingsStore.getValue("Registration.mobileRegistrationHelper"); const newState: Partial = { view: Views.REGISTER,