Skip to content

Commit

Permalink
recaptcha validation
Browse files Browse the repository at this point in the history
  • Loading branch information
codeschris committed Dec 5, 2023
1 parent 0c9c246 commit ff82266
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions frontend/src/pages/sessions/register-member.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,23 @@ const MemberRegistration = () => {

const handleSubmit = async (e) => {
e.preventDefault();



// Check if reCAPTCHA value is present
if (!recaptchaValue) {
console.error('reCAPTCHA not completed');
return;
}

// Include the reCAPTCHA value in your form data
const formDataWithRecaptcha = { ...formData, recaptchaValue };

try {
const response = await axios.post('https://codeschris.pythonanywhere.com/api/members/', formDataWithRecaptcha, {
headers: {
'Content-Type': 'application/json',
},
});

if (response.status === 201) {
console.log('Member registered successfully');
window.location.reload(); // replace with message page. this reloads the screen after form submission
Expand Down

0 comments on commit ff82266

Please sign in to comment.