Skip to content

Commit

Permalink
changed reCaptcha to hCaptcha
Browse files Browse the repository at this point in the history
  • Loading branch information
begmuhommet committed Nov 28, 2024
1 parent 7afb22c commit 1aaaae7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
NODE_ENV=production
NODE_ENV=production
NEXT_PUBLIC_RECAPTCHA_SECRET_KEY=
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
23 changes: 20 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@emailjs/browser": "4.4.1",
"@hcaptcha/react-hcaptcha": "1.11.0",
"@radix-ui/react-accordion": "1.2.1",
"@radix-ui/react-avatar": "1.1.1",
"@radix-ui/react-dialog": "1.1.2",
Expand Down
11 changes: 5 additions & 6 deletions src/sections/form/FormSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Textarea } from '@/components/ui/textarea';
import { useToast } from '@/hooks/use-toast';
import { cn } from '@/lib/utils';
import email from '@emailjs/browser';
import HCaptcha from '@hcaptcha/react-hcaptcha';
import { Loader } from 'lucide-react';
import React, { ChangeEvent, FormEvent, useEffect, useState } from 'react';
import ReCAPTCHA from 'react-google-recaptcha';

const initialData = {
name: '',
Expand All @@ -31,10 +31,8 @@ const FormSection: React.FC = () => {

// Effects
useEffect(() => {
console.log('env -> ', process.env);

if (!process.env.NEXT_PUBLIC_EMAIL_PUBLIC_KEY) {
console.log('public key is undefined');
console.warn('public key is undefined');
return;
}
email.init(process.env.NEXT_PUBLIC_EMAIL_PUBLIC_KEY);
Expand Down Expand Up @@ -177,9 +175,10 @@ const FormSection: React.FC = () => {

<div className="flex items-center justify-center">
{!!process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY && (
<ReCAPTCHA
<HCaptcha
size="normal"
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY}
onChange={handleRecaptchaChange}
onVerify={handleRecaptchaChange}
/>
)}
</div>
Expand Down

0 comments on commit 1aaaae7

Please sign in to comment.