mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Add hCaptcha
This commit is contained in:
parent
f38136b499
commit
082c1ccb26
8 changed files with 115 additions and 7 deletions
|
@ -53,6 +53,10 @@ class LoginController extends Controller
|
||||||
'password' => 'required|string|min:6',
|
'password' => 'required|string|min:6',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if(config('captcha.enabled')) {
|
||||||
|
$rules['h-captcha-response'] = 'required|captcha';
|
||||||
|
}
|
||||||
|
|
||||||
$this->validate($request, $rules);
|
$this->validate($request, $rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,10 @@ class RegisterController extends Controller
|
||||||
'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed',
|
'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if(config('captcha.enabled')) {
|
||||||
|
$rules['h-captcha-response'] = 'required|captcha';
|
||||||
|
}
|
||||||
|
|
||||||
return Validator::make($data, $rules);
|
return Validator::make($data, $rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"ext-openssl": "*",
|
"ext-openssl": "*",
|
||||||
"beyondcode/laravel-self-diagnosis": "^1.0.2",
|
"beyondcode/laravel-self-diagnosis": "^1.0.2",
|
||||||
"brick/math": "^0.8",
|
"brick/math": "^0.8",
|
||||||
|
"buzz/laravel-h-captcha": "1.0.2",
|
||||||
"doctrine/dbal": "^2.7",
|
"doctrine/dbal": "^2.7",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
|
@ -39,8 +40,8 @@
|
||||||
"predis/predis": "^1.1",
|
"predis/predis": "^1.1",
|
||||||
"spatie/laravel-backup": "^6.0.0",
|
"spatie/laravel-backup": "^6.0.0",
|
||||||
"spatie/laravel-image-optimizer": "^1.1",
|
"spatie/laravel-image-optimizer": "^1.1",
|
||||||
"symfony/http-kernel": "5.1.5",
|
"stevebauman/purify": "3.0.*",
|
||||||
"stevebauman/purify": "3.0.*"
|
"symfony/http-kernel": "5.1.5"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.0",
|
"facade/ignition": "^2.0",
|
||||||
|
|
72
composer.lock
generated
72
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "2fa0012197581d98d4c04d1b83448d34",
|
"content-hash": "d1c65fe7e4f498b01260f09a3eb04015",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "alchemy/binary-driver",
|
"name": "alchemy/binary-driver",
|
||||||
|
@ -319,6 +319,74 @@
|
||||||
],
|
],
|
||||||
"time": "2020-08-18T23:41:20+00:00"
|
"time": "2020-08-18T23:41:20+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "buzz/laravel-h-captcha",
|
||||||
|
"version": "v1.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thinhbuzz/laravel-h-captcha.git",
|
||||||
|
"reference": "41a063bea0e204ae5b8afbafce981d4675dd8af7"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thinhbuzz/laravel-h-captcha/zipball/41a063bea0e204ae5b8afbafce981d4675dd8af7",
|
||||||
|
"reference": "41a063bea0e204ae5b8afbafce981d4675dd8af7",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"guzzlehttp/guzzle": "6.*|7.*",
|
||||||
|
"illuminate/support": "5.*|6.*|7.*|8.*",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Buzz\\LaravelHCaptcha\\CaptchaServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Captcha": "Buzz\\LaravelHCaptcha\\CaptchaFacade"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Buzz\\LaravelHCaptcha\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "ThinhBuzz",
|
||||||
|
"email": "mr.thinhbuzz@gmail.com",
|
||||||
|
"homepage": "https://www.facebook.com/thinh.buzz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "hCaptcha for Laravel 5, Laravel 6, Laravel 7 and Laravel 8",
|
||||||
|
"homepage": "https://github.com/thinhbuzz/laravel-h-captcha",
|
||||||
|
"keywords": [
|
||||||
|
"captcha",
|
||||||
|
"h captcha",
|
||||||
|
"h-captcha",
|
||||||
|
"hcaptcha",
|
||||||
|
"laravel",
|
||||||
|
"laravel 5",
|
||||||
|
"laravel 6",
|
||||||
|
"laravel 7",
|
||||||
|
"laravel 8",
|
||||||
|
"laravel5",
|
||||||
|
"laravel6",
|
||||||
|
"laravel7"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/thinhbuzz/laravel-h-captcha/issues",
|
||||||
|
"source": "https://github.com/thinhbuzz/laravel-h-captcha/tree/v1.0.2"
|
||||||
|
},
|
||||||
|
"time": "2020-09-14T15:04:45+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cakephp/chronos",
|
"name": "cakephp/chronos",
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
|
@ -10132,5 +10200,5 @@
|
||||||
"ext-openssl": "*"
|
"ext-openssl": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "1.1.0"
|
"plugin-api-version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
15
config/captcha.php
Normal file
15
config/captcha.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'enabled' => env('CAPTCHA_ENABLED', false),
|
||||||
|
'secret' => env('CAPTCHA_SECRET', 'default_secret'),
|
||||||
|
'sitekey' => env('CAPTCHA_SITEKEY', 'default_sitekey'),
|
||||||
|
'http_client' => \Buzz\LaravelHCaptcha\HttpClient::class,
|
||||||
|
'options' => [
|
||||||
|
'multiple' => false,
|
||||||
|
'lang' => app()->getLocale(),
|
||||||
|
],
|
||||||
|
'attributes' => [
|
||||||
|
'theme' => 'light'
|
||||||
|
],
|
||||||
|
];
|
|
@ -4,8 +4,8 @@
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-lg-5">
|
<div class="col-lg-5">
|
||||||
<div class="card">
|
<div class="">
|
||||||
<div class="card-header bg-white p-3 text-center font-weight-bold">{{ __('Login') }}</div>
|
<div class="card-header bg-transparent p-3 text-center font-weight-bold">{{ __('Login') }}</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form method="POST" action="{{ route('login') }}" class="px-5">
|
<form method="POST" action="{{ route('login') }}" class="px-5">
|
||||||
|
@ -50,6 +50,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if(config('captcha.enabled'))
|
||||||
|
<div class="d-flex justify-content-center mb-3">
|
||||||
|
{!! app('captcha')->display() !!}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="form-group row mb-0">
|
<div class="form-group row mb-0">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">
|
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">
|
||||||
|
|
|
@ -81,6 +81,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if(config('captcha.enabled'))
|
||||||
|
<div class="d-flex justify-content-center my-3">
|
||||||
|
{!! app('captcha')->display() !!}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<p class="small">By signing up, you agree to our <a href="{{route('site.terms')}}" class="font-weight-bold text-dark">Terms of Use</a> and <a href="{{route('site.privacy')}}" class="font-weight-bold text-dark">Privacy Policy</a>.</p>
|
<p class="small">By signing up, you agree to our <a href="{{route('site.terms')}}" class="font-weight-bold text-dark">Terms of Use</a> and <a href="{{route('site.privacy')}}" class="font-weight-bold text-dark">Privacy Policy</a>.</p>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
|
|
|
@ -108,7 +108,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if(config('captcha.enabled'))
|
||||||
|
<div class="d-flex justify-content-center mb-3">
|
||||||
|
{!! app('captcha')->display() !!}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
<div class="form-group row mb-0">
|
<div class="form-group row mb-0">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold text-uppercase">
|
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold text-uppercase">
|
||||||
|
|
Loading…
Reference in a new issue