diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index c68ed7e..d3052d1 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -51,6 +51,7 @@ class RegisterController extends Controller 'name' => 'required|string|regex:/^[a-zA-Z0-9_-]+$/u|max:15|unique:users', 'email' => 'required|string|email|max:255|unique:users', 'password' => 'required|string|min:6|confirmed', + 'g-recaptcha-response' => 'required|captcha' ], ['name.regex' => 'ユーザー名には半角英数字とアンダーバー、ハイフンのみ使用できます。'], ['name' => 'ユーザー名'] diff --git a/resources/lang/ja/validation.php b/resources/lang/ja/validation.php index 7b11851..9c9217f 100644 --- a/resources/lang/ja/validation.php +++ b/resources/lang/ja/validation.php @@ -99,6 +99,10 @@ return [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], + 'g-recaptcha-response' => [ + 'required' => '「私はロボットではありません」にチェックを入れてください。', + 'captcha' => 'reCAPTCHAチェックに失敗しました。何度試しても解決しない場合、管理者にお問い合わせください。', + ], ], /* diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 7ef6a7d..59b2fa9 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -2,6 +2,10 @@ @section('title', '新規登録') +@push('head') + {!! NoCaptcha::renderJs() !!} +@endpush + @section('content')

新規登録

@@ -53,6 +57,14 @@
+
+
+ {!! NoCaptcha::display() !!} +
+ @if ($errors->has('g-recaptcha-response')) +
{{ $errors->first('g-recaptcha-response') }}
+ @endif +