diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 0e620e8d046..c5abe526f61 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -139,20 +139,8 @@ export default class Registration extends React.Component { componentDidMount() { this.replaceClient(this.props.serverConfig); - //triggers a confirmation dialog for data loss before page unloads/refreshes - window.addEventListener("beforeunload", this.unloadCallback); } - componentWillUnmount() { - window.removeEventListener("beforeunload", this.unloadCallback); - } - - private unloadCallback = (event: BeforeUnloadEvent) => { - event.preventDefault(); - event.returnValue = ""; - return ""; - }; - // TODO: [REACT-WARNING] Replace with appropriate lifecycle event // eslint-disable-next-line UNSAFE_componentWillReceiveProps(newProps) { diff --git a/src/components/views/auth/CaptchaForm.tsx b/src/components/views/auth/CaptchaForm.tsx index 7f718bae6dd..9455cab53c1 100644 --- a/src/components/views/auth/CaptchaForm.tsx +++ b/src/components/views/auth/CaptchaForm.tsx @@ -65,12 +65,21 @@ export default class CaptchaForm extends React.Component { + event.preventDefault(); + event.returnValue = ""; + return ""; + }; + // Borrowed directly from: https://github.com/codeep/react-recaptcha-google/commit/e118fa5670fa268426969323b2e7fe77698376ba private isRecaptchaReady(): boolean { return typeof window !== "undefined" && diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.tsx b/src/components/views/auth/InteractiveAuthEntryComponents.tsx index 11a28d1e05d..d0d43340094 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.tsx +++ b/src/components/views/auth/InteractiveAuthEntryComponents.tsx @@ -320,8 +320,20 @@ export class TermsAuthEntry extends React.Component { + event.preventDefault(); + event.returnValue = ""; + return ""; + }; + private togglePolicy(policyId: string) { const newToggles = {}; for (const policy of this.state.policies) {