Browse Source

Google reCaptcha

strapiSEO
ntasicc 3 years ago
parent
commit
3b67e16d15

+ 2
- 0
frontend/.env View File

@@ -11,3 +11,5 @@ MAILCHIMP_FORM_URL = http://eepurl.com/iaRrv1
GOOGLE_TRACKING_ID = "G-PTZC3WLTZ1"
REACT_APP_MEASUREMENT_ID = G-PD7YZVDG30
REACT_APP_SITE_KEY = 6LdCnHgjAAAAAAV4z_GBHwLYdKhxE9Y3oBzO6cxK
REACT_APP_CAPTCHA_API = https://api-captcha.dilig.net
REACT_APP_MAILGUN_API_KEY = fafafe4f47e11436bd3d46796055222e-835621cf-4db83844

+ 101
- 14
frontend/package-lock.json View File

@@ -1,12 +1,12 @@
{
"name": "frontend",
"version": "1.1.8",
"version": "1.1.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "frontend",
"version": "1.1.8",
"version": "1.1.9",
"dependencies": {
"@faceless-ui/slider": "^1.1.14",
"@faceless-ui/window-info": "^2.1.1",
@@ -21,8 +21,10 @@
"emailjs": "^4.0.0",
"emailjs-com": "^3.2.0",
"eslint-plugin-prettier": "^4.0.0",
"form-data": "^4.0.0",
"formik": "^2.2.9",
"framer-motion": "^6.3.4",
"mailgun.js": "^8.0.6",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-cookie": "^4.1.1",
@@ -5119,6 +5121,11 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/base-64": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz",
"integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
},
"node_modules/batch": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
@@ -7967,9 +7974,9 @@
"integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw=="
},
"node_modules/follow-redirects": {
"version": "1.14.8",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==",
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"funding": [
{
"type": "individual",
@@ -8170,9 +8177,9 @@
}
},
"node_modules/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@@ -11272,6 +11279,19 @@
}
}
},
"node_modules/jsdom/node_modules/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
@@ -11570,6 +11590,25 @@
"sourcemap-codec": "^1.4.4"
}
},
"node_modules/mailgun.js": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-8.0.6.tgz",
"integrity": "sha512-b+c7QO1T4oFsudEcRB2H7oZKth8ZDeYRW4xjW12QQVNYDSJCVxqSQfps6ofcH8fqcCMJdzc76HVNGdnUZgBPCw==",
"dependencies": {
"axios": "^0.27.2",
"base-64": "^1.0.0",
"url-join": "^4.0.1"
}
},
"node_modules/mailgun.js/node_modules/axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"dependencies": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -16879,6 +16918,11 @@
"punycode": "^2.1.0"
}
},
"node_modules/url-join": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -21623,6 +21667,11 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"base-64": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz",
"integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
},
"batch": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz",
@@ -23742,9 +23791,9 @@
"integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw=="
},
"follow-redirects": {
"version": "1.14.8",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA=="
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
},
"fork-ts-checker-webpack-plugin": {
"version": "6.5.0",
@@ -23872,9 +23921,9 @@
}
},
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@@ -26089,6 +26138,18 @@
"whatwg-url": "^8.5.0",
"ws": "^7.4.6",
"xml-name-validator": "^3.0.0"
},
"dependencies": {
"form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}
}
},
"jsesc": {
@@ -26334,6 +26395,27 @@
"sourcemap-codec": "^1.4.4"
}
},
"mailgun.js": {
"version": "8.0.6",
"resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-8.0.6.tgz",
"integrity": "sha512-b+c7QO1T4oFsudEcRB2H7oZKth8ZDeYRW4xjW12QQVNYDSJCVxqSQfps6ofcH8fqcCMJdzc76HVNGdnUZgBPCw==",
"requires": {
"axios": "^0.27.2",
"base-64": "^1.0.0",
"url-join": "^4.0.1"
},
"dependencies": {
"axios": {
"version": "0.27.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
"requires": {
"follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
}
}
}
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -30016,6 +30098,11 @@
"punycode": "^2.1.0"
}
},
"url-join": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

+ 3
- 1
frontend/package.json View File

@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "1.1.9",
"version": "1.1.10",
"private": true,
"dependencies": {
"@faceless-ui/slider": "^1.1.14",
@@ -16,8 +16,10 @@
"emailjs": "^4.0.0",
"emailjs-com": "^3.2.0",
"eslint-plugin-prettier": "^4.0.0",
"form-data": "^4.0.0",
"formik": "^2.2.9",
"framer-motion": "^6.3.4",
"mailgun.js": "^8.0.6",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-cookie": "^4.1.1",

+ 39
- 25
frontend/src/components/shared/ClientForm.jsx View File

@@ -67,7 +67,6 @@ export default function ClientForm() {
Lastname: values.lastName,
Description: values.description,
};

const token = captchaRef.current.getValue();
captchaRef.current.reset();
if (token.length === 0) {
@@ -75,34 +74,40 @@ export default function ClientForm() {
setMsgText('Please fill reCAPTCHA and try again. Thank you!');
} else {
await axios
.post('http://localhost:2000/verify-token', { token })
.post(`${process.env.REACT_APP_CAPTCHA_API}/verify-token`, { token })
.then(res => {
setSucMsg(true);
if (res.data.data.success)
if (res.data.data.success) {
setMsgText('Submission Succesful! Thank you!');
else setMsgText('Please fill reCAPTCHA and try again. Thank you!');
// mg.messages.create('dilig.net', {
// from: `${values.firstName} ${values.lastName} <${values.email}>`,
// to: ['nikola.tasic@dilig.net'],
// subject: `${values.subject}`,
// text: `${values.description}`,
// html: `<p>${values.description}</p>`,
// });
emailjs
.send(
process.env.REACT_APP_SERVICE_ID,
process.env.REACT_APP_CLIENT_TEMPLATE_ID,
data,
process.env.REACT_APP_USER_ID,
)
.then(
result => {
console.log(result.text);
setSucMsg(true);
},
error => {
console.log(error.text);
},
);
} else setMsgText('Please fill reCAPTCHA and try again. Thank you!');
})
.catch(error => {
console.log(error);
});
}

// emailjs
// .send(
// process.env.REACT_APP_SERVICE_ID,
// process.env.REACT_APP_CLIENT_TEMPLATE_ID,
// data,
// process.env.REACT_APP_USER_ID,
// )
// .then(
// result => {
// console.log(result.text);
// setSucMsg(true);
// },
// error => {
// console.log(error.text);
// },
// );
ReactGA.event('contact', {
category: 'Contact',
action: 'Business Inquiry',
@@ -233,10 +238,19 @@ export default function ClientForm() {
/>
</div>
</div>
<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
/>
<div className="items-center justify-end hidden sm:flex">
<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
/>
</div>
<div className="flex items-center justify-end sm:hidden">
<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
size="compact"
/>
</div>
<div className=" py-3 text-right">
<button
type="submit"

+ 26
- 5
frontend/src/components/shared/Contact.jsx View File

@@ -16,6 +16,16 @@ import PageTitle from './PageTitle';
import Wrapper from '../../layout/Wrapper';
import { UIContext } from './../../context/index';

// import Mailgun from 'mailgun.js';
// import FormData from 'form-data';

// const mailgun = new Mailgun(FormData);
// const mg = mailgun.client({
// username: 'api',
// key: process.env.REACT_APP_MAILGUN_API_KEY,
// url: 'https://api.eu.mailgun.net',
// });

export default function Contact(props) {
const [tab, setTab] = useState(true);
const [tabTitle, setTabTitle] = useState('Tell Us About Your Idea!');
@@ -28,7 +38,7 @@ export default function Contact(props) {
//if (event.button !== 0)
event.preventDefault();
}
const {uiContext, setUiContext} = useContext(UIContext);
const { uiContext, setUiContext } = useContext(UIContext);
const clientContext = useContext(ClientFormContext);
const jobContext = useContext(JobFormContext);

@@ -108,14 +118,25 @@ export default function Contact(props) {
<OrbitOnClick tab={tab} />
</div>
<div className="py-16 relative">
<div className="flex justify-end flex-col" >
<div className="flex justify-end flex-col">
<Tab.Group
defaultIndex={props.defaultIndex}
onChange={index => handleTab(index)}
>
<div className="flex flex-col md:flex-row items-start md:items-baseline md:justify-between" onMouseDown={handleTabClick}>
{tab ? <PageTitle left heading={"Tell Us About Your Idea!"} subheading={'Contact us'} /> : <PageTitle left heading={"Join Diligent!"} subheading={'Cotact us'} />}
<div
className="flex flex-col md:flex-row items-start md:items-baseline md:justify-between"
onMouseDown={handleTabClick}
>
{tab ? (
<PageTitle
left
heading={'Tell Us About Your Idea!'}
subheading={'Contact us'}
/>
) : (
<PageTitle left heading={'Join Diligent!'} subheading={'Cotact us'} />
)}

<Tab.List className="flex flex-row items-center md:flex-col lg:flex-row h-fit w-fit max-w-max md:ml-auto z-20 p-1 min-h-12 space-x-1 bg-dg-primary-400 rounded-xl my-4 align-middle">
<Tab
className={({ selected }) =>

+ 75
- 28
frontend/src/components/shared/JobForm.jsx View File

@@ -25,7 +25,6 @@ export default function JobForm(props) {
const [otherInputState, setOtherInputState] = useState(true);
const [selectedPosition, setSelectedPosition] = useState('');
const [errorMsg, setErrorMsg] = useState('');

const fileInput = useRef();

function changeFormHandler(event) {
@@ -101,8 +100,8 @@ export default function JobForm(props) {
//console.log(file);
return new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.readAsDataURL(file);

fileReader.readAsDataURL(file);
fileReader.onload = () => {
resolve(fileReader.result);
};
@@ -118,6 +117,46 @@ export default function JobForm(props) {
setErrorMsg('CV is Required');
} else {
setErrorMsg('');
// if (jobForm.file.size >= 2000000) {
// setErrorMsg('File too large!');
// } else {
// const file = {
// filename: 'CV.pdf',
// data: jobForm.file,
// };

// const token = captchaRef.current.getValue();
// captchaRef.current.reset();
// if (token.length === 0) {
// setSucMsg(true);
// setMsgText('Please fill reCAPTCHA and try again. Thank you!');
// } else {
// await axios
// .post(`${process.env.REACT_APP_CAPTCHA_API}/verify-token`, {
// token,
// })
// .then(res => {
// setSucMsg(true);
// if (res.data.data.success) {
// setMsgText('Submission Succesful! Thank you!');

// props.mg.messages.create('dilig.net', {
// from: `${values.firstName} ${values.lastName} <${values.email}>`,
// to: ['hr@dilig.net'],
// subject: 'Applying for a position',
// text: `Position:${values.position} ${values.other}, Cover letter: ${values.coverLetter}, Link: ${values.link} `,
// html: `<p>Position: ${selectedPosition} ${values.other}</p><p>Cover letter: ${values.coverLetter}</p><p>Link (optional): ${values.link}</p>`,
// attachment: file,
// });
// } else
// setMsgText('Please fill reCAPTCHA and try again. Thank you!');
// })
// .catch(error => {
// console.log(error);
// });
//}
//}

prepFile(jobForm.file).then(async res => {
const newtemplateParams = {
Position: values.position,
@@ -137,35 +176,36 @@ export default function JobForm(props) {
setMsgText('Please fill reCAPTCHA and try again. Thank you!');
} else {
await axios
.post('http://localhost:2000/verify-token', { token })
.post(`${process.env.REACT_APP_CAPTCHA_API}/verify-token`, {
token,
})
.then(res => {
setSucMsg(true);
if (res.data.data.success)
if (res.data.data.success) {
setMsgText('Submission Succesful! Thank you!');
else
emailjs
.send(
process.env.REACT_APP_SERVICE_ID,
process.env.REACT_APP_JOB_TEMPLATE_ID,
newtemplateParams,
process.env.REACT_APP_USER_ID,
)
.then(
result => {
console.log(result.text);
setSucMsg(true);
},
error => {
console.log(error.text);
},
);
} else
setMsgText('Please fill reCAPTCHA and try again. Thank you!');
})
.catch(error => {
console.log(error);
});
}

// emailjs
// .send(
// process.env.REACT_APP_SERVICE_ID,
// process.env.REACT_APP_JOB_TEMPLATE_ID,
// newtemplateParams,
// process.env.REACT_APP_USER_ID,
// )
// .then(
// result => {
// console.log(result.text);
// setSucMsg(true);
// },
// error => {
// console.log(error.text);
// },
// );
});
}
ReactGA.event('contact', {
@@ -392,12 +432,19 @@ export default function JobForm(props) {
<div className="text-sm text-right">{errorMsg}</div>
</div>
</div>

<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
/>

<div className="items-center justify-end hidden sm:flex">
<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
/>
</div>
<div className="flex items-center justify-end sm:hidden">
<ReCAPTCHA
sitekey={process.env.REACT_APP_SITE_KEY}
ref={captchaRef}
size="compact"
/>
</div>
<div className=" py-3 text-right">
<button
type="submit"

+ 3
- 1
frontend/src/components/shared/MyDropzone.jsx View File

@@ -8,7 +8,6 @@ export default function MyDropzone(props) {
const [file, setFile] = useState('');
const [empty, setEmpty] = useState(true);


function emptyFiles() {
const newFile = [];
setFile(newFile);
@@ -32,6 +31,9 @@ export default function MyDropzone(props) {
if (acceptedFiles && acceptedFiles.length > 0) {
if (acceptedFiles[0] !== 'undefined' && acceptedFiles[0].type !== 'undefined') {
if (acceptedFiles[0].type === 'application/pdf') {
// const files = Array.from(acceptedFiles);
// const fileBuffer = await files[0];
// setFile(fileBuffer);
acceptedFiles.map(file => {
setFile(file);
});

+ 40
- 4
frontend/yarn.lock View File

@@ -2656,6 +2656,14 @@
dependencies:
"follow-redirects" "^1.14.8"

"axios@^0.27.2":
"integrity" "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="
"resolved" "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
"version" "0.27.2"
dependencies:
"follow-redirects" "^1.14.9"
"form-data" "^4.0.0"

"axobject-query@^2.2.0":
"integrity" "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA=="
"resolved" "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz"
@@ -2848,6 +2856,11 @@
"resolved" "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
"version" "1.0.2"

"base-64@^1.0.0":
"integrity" "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
"resolved" "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz"
"version" "1.0.0"

"batch@0.6.1":
"integrity" "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY="
"resolved" "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz"
@@ -4658,10 +4671,10 @@
"resolved" "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz"
"version" "3.2.4"

"follow-redirects@^1.0.0", "follow-redirects@^1.14.8":
"integrity" "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA=="
"resolved" "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz"
"version" "1.14.8"
"follow-redirects@^1.0.0", "follow-redirects@^1.14.8", "follow-redirects@^1.14.9":
"integrity" "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
"resolved" "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz"
"version" "1.15.2"

"fork-ts-checker-webpack-plugin@^6.5.0":
"integrity" "sha512-cS178Y+xxtIjEUorcHddKS7yCMlrDPV31mt47blKKRfMd70Kxu5xruAFE2o9sDY6wVC5deuob/u/alD04YYHnw=="
@@ -4691,6 +4704,15 @@
"combined-stream" "^1.0.8"
"mime-types" "^2.1.12"

"form-data@^4.0.0":
"integrity" "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
"resolved" "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
"version" "4.0.0"
dependencies:
"asynckit" "^0.4.0"
"combined-stream" "^1.0.8"
"mime-types" "^2.1.12"

"formik@^2.2.9":
"integrity" "sha512-LQLcISMmf1r5at4/gyJigGn0gOwFbeEAlji+N9InZF6LIMXnFNkO42sCI8Jt84YZggpD4cPWObAZaxpEFtSzNA=="
"resolved" "https://registry.npmjs.org/formik/-/formik-2.2.9.tgz"
@@ -6305,6 +6327,15 @@
dependencies:
"sourcemap-codec" "^1.4.4"

"mailgun.js@^8.0.6":
"integrity" "sha512-b+c7QO1T4oFsudEcRB2H7oZKth8ZDeYRW4xjW12QQVNYDSJCVxqSQfps6ofcH8fqcCMJdzc76HVNGdnUZgBPCw=="
"resolved" "https://registry.npmjs.org/mailgun.js/-/mailgun.js-8.0.6.tgz"
"version" "8.0.6"
dependencies:
"axios" "^0.27.2"
"base-64" "^1.0.0"
"url-join" "^4.0.1"

"make-dir@^3.0.0", "make-dir@^3.0.2", "make-dir@^3.1.0":
"integrity" "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="
"resolved" "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz"
@@ -9426,6 +9457,11 @@
dependencies:
"punycode" "^2.1.0"

"url-join@^4.0.1":
"integrity" "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
"resolved" "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz"
"version" "4.0.1"

"util-deprecate@^1.0.1", "util-deprecate@^1.0.2", "util-deprecate@~1.0.1":
"integrity" "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
"resolved" "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"

+ 0
- 1
server/.env View File

@@ -1 +0,0 @@
SECRET_KEY = 6LdCnHgjAAAAACTeAyhfpPd8pIHVlcV5AegVPwnN

+ 0
- 23
server/.gitignore View File

@@ -1,23 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

+ 0
- 48
server/index.js View File

@@ -1,48 +0,0 @@
const express = require("express");
const router = express.Router();
const app = express();
const cors = require("cors");
const axios = require("axios");
const dotenv = require("dotenv").config();
const port = process.env.PORT || 2000;

//enabling cors
app.use(cors());

//Parse data
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

//add router in express
app.use("/", router);

//Ping server
router.get("/ping", (req, res) => {
return res.status(200).json({ message: "Server is running" });
});

//Verify reCAPTCHA token
router.post("/verify-token", async (req, res) => {
try {
let token = req.body.token;

let response = await axios.post(
`https://www.google.com/recaptcha/api/siteverify?secret=${process.env.SECRET_KEY}&response=${token}`
);
console.log(response.data);
return res.status(200).json({
success: true,
message: "Token successfully verified",
data: response.data,
});
} catch (error) {
return res.status(500).json({
success: false,
message: "Error verifying token",
});
}
});

app.listen(port, () => {
console.log(`server is running on ${port}`);
});

+ 0
- 1187
server/package-lock.json
File diff suppressed because it is too large
View File


+ 0
- 18
server/package.json View File

@@ -1,18 +0,0 @@
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --watch index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^1.2.1",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2"
}
}

Loading…
Cancel
Save