Просмотр исходного кода

Update login/register views and captcha config, enable login or register captchas or both

Daniel Supernault 2 лет назад
Родитель
Сommit
c071c7195e

+ 1 - 1
app/Http/Controllers/Auth/LoginController.php

@@ -70,7 +70,7 @@ class LoginController extends Controller
             'password'        => 'required|string|min:6',
         ];
 
-        if(config('captcha.enabled')) {
+        if(config('captcha.enabled') || config('captcha.active.login')) {
             $rules['h-captcha-response'] = 'required|captcha';
         }
         

+ 1 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -137,7 +137,7 @@ class RegisterController extends Controller
 			'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed',
 		];
 
-		if(config('captcha.enabled')) {
+		if(config('captcha.enabled') || config('captcha.active.register')) {
 			$rules['h-captcha-response'] = 'required|captcha';
 		}
 

+ 6 - 1
config/captcha.php

@@ -12,4 +12,9 @@ return [
     'attributes' => [
         'theme' => 'light'
     ],
-];
+
+    'active' => [
+    	'login' => env('CAPTCHA_ENABLED_ON_LOGIN', false),
+    	'register' => env('CAPTCHA_ENABLED_ON_REGISTER', false)
+    ]
+];

+ 1 - 1
resources/views/auth/login.blade.php

@@ -50,7 +50,7 @@
                             </div>
                         </div>
 
-                        @if(config('captcha.enabled'))
+                        @if(config('captcha.enabled') || config('captcha.active.login'))
                         <div class="d-flex justify-content-center mb-3">
                             {!! Captcha::display() !!}
                         </div>

+ 1 - 1
resources/views/auth/register.blade.php

@@ -81,7 +81,7 @@
                             </div>
                         </div>
 
-                        @if(config('captcha.enabled'))
+                        @if(config('captcha.enabled') || config('captcha.active.register'))
                         <div class="d-flex justify-content-center my-3">
                             {!! Captcha::display() !!}
                         </div>