I have a Next.js app, index page contains only captcha, and after successfull entry redirects to form at mydomain.com/form and that works just fine. But also i can just enter in browser
mydomain.com/form
and get to it without captcha, which i obviously dont want.
Is there a way to restrict all entries except redirect from captcha page? Found only solutions with logins, e.t.c which i dont need.
Im using react-google-recaptcha package
Here is my index page
function Captcha() {
const reRef = useRef<ReCAPTCHA>(null);
const router = useRouter()
return (
<div className={styles.container}>
<h1>Подтвердите, что вы не робот</h1>
<ReCAPTCHA
sitekey={`${process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY}`}
size="normal"
ref={reRef}
onChange={() => router.push('/form')}
/>
</div>
);
}