Skip to content

Commit

Permalink
feat: disables registration form
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Dec 3, 2024
1 parent 652b3e2 commit d646894
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\View\View;
use Illuminate\Validation\ValidationException;

final readonly class RegisteredUserController
{
Expand Down Expand Up @@ -43,6 +44,12 @@ public function store(Request $request): RedirectResponse
'g-recaptcha-response' => app()->environment('production') ? ['required', new Recaptcha($request->ip())] : [],
]);

if (app()->environment('production')) {
throw ValidationException::withMessages([
'email' => 'We have temporarily disabled registration due to spam. We will try to enable it as soon as possible.',
]);
}

$user = User::create([
'name' => $request->name,
'email' => $request->email,
Expand Down

0 comments on commit d646894

Please sign in to comment.