Bot detection Plug for form submissions.
Add it to your pipeline with the list of honeypot fields to check:
plug Honeytrap.Plug, fields: [:website]Runs on POST, PUT, and PATCH requests. Other methods pass through
untouched.
On matching requests it puts a result map into conn.assigns.honeytrap:
%{
bot: true,
reasons: [{:filled, :website}, {:too_fast, :website}],
human_rating: 0.2
}Detection reasons:
{:filled, field}. The honeypot input was submitted with a value.{:too_fast, field}. The form was submitted before:default_delayseconds elapsed.:low_human_rating. The signals rating fell below:minimum_human_rating. Only added when the option is set.
Options
:fields(required). List of honeypot field names to inspect.
The remaining options resolve through Honeytrap.Config, so they can also be
set globally via Application env.
:default_delay:disable_delay:minimum_human_rating:signals_input_name
The Plug never halts the pipeline. Your controller decides what to do with the result.