Make this optional for self hosters

This commit is contained in:
Jackson Harper
2024-04-01 00:05:24 +08:00
parent 2257a5a42e
commit 442475d684
2 changed files with 19 additions and 11 deletions

View File

@ -511,7 +511,7 @@ export function authRouter() {
recaptchaToken,
} = req.body
if (recaptchaToken) {
if (recaptchaToken && process.env.RECAPTCHA_CHALLENGE_SECRET_KEY) {
const verified = await verifyChallengeRecaptcha(recaptchaToken)
if (!verified) {
return res.redirect(

View File

@ -180,16 +180,24 @@ export function EmailSignup(): JSX.Element {
<SignUpForm />
<Recaptcha
setRecaptchaToken={(token) => {
if (recaptchaTokenRef.current) {
recaptchaTokenRef.current.value = token
} else {
console.log('error updating recaptcha token')
}
}}
/>
<input ref={recaptchaTokenRef} type="hidden" name="recaptchaToken" />
{process.env.NEXT_PUBLIC_RECAPTCHA_CHALLENGE_SECRET_KEY && (
<>
<Recaptcha
setRecaptchaToken={(token) => {
if (recaptchaTokenRef.current) {
recaptchaTokenRef.current.value = token
} else {
console.log('error updating recaptcha token')
}
}}
/>
<input
ref={recaptchaTokenRef}
type="hidden"
name="recaptchaToken"
/>
</>
)}
{errorMessage && (
<StyledText style="error">{errorMessage}</StyledText>