feat(contact): Add hCaptcha integration, Discord alert for contact

- Added hCaptcha validation to the contact form.
- Integrated hCaptcha configuration in the application.
- Implemented Discord alerts for new contact submissions with detailed content.
This commit is contained in:
Rico van Zelst
2024-02-24 21:52:00 +01:00
parent 1ed7856985
commit 8bdcd5b086
6 changed files with 131 additions and 38 deletions

View File

@@ -11,10 +11,11 @@ class ContactSubmissionRequest extends FormRequest
return [
'name' => ['required', 'max:254'],
'email' => ['required', 'email', 'max:254'],
'discord' => ['nullable', 'min:2', 'max:34'],
'discord' => ['nullable', 'min:2', 'max:35'],
'category' => ['required', 'in:question,advertising,bug_report,feedback,other'],
'subject' => ['required', 'max:254'],
'message' => ['required', 'unique:contact_submissions', 'max:3500'],
'h-captcha-response' => 'required|HCaptcha'
];
}
@@ -22,4 +23,14 @@ class ContactSubmissionRequest extends FormRequest
{
return true;
}
public function messages(): array
{
return [
'h-captcha-response.required' => 'Please verify that you are not a robot.',
'h-captcha-response.h_captcha' => 'Failed to validate captcha.',
'category.in' => 'Invalid category.',
'message.unique' => 'You have already submitted this message.',
];
}
}