This commit is contained in:
		| @@ -6,7 +6,7 @@ export async function getReCaptchaSiteKey() { | |||||||
|   return process.env.RECAPTCHA_SITE_KEY; |   return process.env.RECAPTCHA_SITE_KEY; | ||||||
| } | } | ||||||
|  |  | ||||||
| const RECAPTCHA_SECRET_KEY = process.env.RECAPTCHA_SECRET_KEY; | const RECAPTCHA_SERVER_KEY = process.env.RECAPTCHA_SERVER_KEY; | ||||||
|  |  | ||||||
| export type SubmitContactReturn = { error: string } | { success: true }; | export type SubmitContactReturn = { error: string } | { success: true }; | ||||||
|  |  | ||||||
| @@ -14,9 +14,9 @@ export default async function SubmitContact( | |||||||
|   prevState: unknown, |   prevState: unknown, | ||||||
|   data: FormData |   data: FormData | ||||||
| ): Promise<SubmitContactReturn> { | ): Promise<SubmitContactReturn> { | ||||||
|   if (!RECAPTCHA_SECRET_KEY) { |   if (!RECAPTCHA_SERVER_KEY) { | ||||||
|     console.error( |     console.error( | ||||||
|       "RECAPTCHA_SECRET_KEY is not set. Please check your environment variables." |       "RECAPTCHA_SERVER_KEY is not set. Please check your environment variables." | ||||||
|     ); |     ); | ||||||
|     throw new Error("Server error: RECAPTCHA not configure correctly."); |     throw new Error("Server error: RECAPTCHA not configure correctly."); | ||||||
|   } |   } | ||||||
| @@ -42,7 +42,7 @@ export default async function SubmitContact( | |||||||
|         headers: { |         headers: { | ||||||
|           "Content-Type": "application/x-www-form-urlencoded", |           "Content-Type": "application/x-www-form-urlencoded", | ||||||
|         }, |         }, | ||||||
|         body: `secret=${RECAPTCHA_SECRET_KEY}&response=${recaptcha}`, |         body: `secret=${RECAPTCHA_SERVER_KEY}&response=${recaptcha}`, | ||||||
|       } |       } | ||||||
|     ); |     ); | ||||||
|     const recaptchaData = await recaptchaResponse.json(); |     const recaptchaData = await recaptchaResponse.json(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user