-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpamProtection to use the honeypot everywhere #107
Conversation
Looks good, ping me again when tests have been added. |
I replaced many code parts because my first version wasn't good for me. So, look at the Tests are ready. |
Thanks! I'll polish a bit on |
❤️ |
Do you have any idea about the release date? Thanks for all your effort. |
O, I thought I already done that. There you go: https://github.com/spatie/laravel-honeypot/releases/tag/4.3.0 Thanks again! |
@masterix21 @freekmurze Maybe this can be added to the README? By using an extra trait, it can be included with ease into every component with minimal code: <?php
namespace App\Traits;
use Spatie\Honeypot\Http\Livewire\Concerns\HoneypotData;
use Spatie\Honeypot\Http\Livewire\Concerns\UsesSpamProtection;
trait WithHoneypot
{
use UsesSpamProtection;
public HoneypotData $extraFields;
public function mountWithHoneypot()
{
$this->extraFields = new HoneypotData();
}
} e.g. signup <?php
use App\Traits\WithHoneypot;
class SignupComponent extends Component
{
use WithHoneypot;
public function submit()
{
// Protect against spam
$this->protectAgainstSpam();
// Validate request
$validated = $this->validate();
// ..
}
} |
@francoism90 Feel free to PR that to the readme. |
@francoism90: I didn't create a trait like yours only to randomize the forms better, but as Freek said, feel free to PR it (I'm not a maintainer here, so I can't help you). |
It adds the ability to use the honeypot everywhere through a trait: for example, in a Livewire component.
I will add a test before the merge (if it will be approved).