Skip to content

Commit

Permalink
Merge pull request #39 from wagtail-packages/release
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
nickmoreton authored Jul 13, 2024
2 parents aac39ba + fb92143 commit 42e93d7
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 1,961 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ jobs:
test-sqlite:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["3.9", "3.10", "3.11", "3.12"]
database: ["sqlite"]

steps:
Expand Down Expand Up @@ -45,9 +44,8 @@ jobs:
test-postgres:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["3.12"]
database: ["postgres"]

services:
Expand Down Expand Up @@ -93,14 +91,13 @@ jobs:
test-mysql:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["3.12"]
database: ["mysql"]

services:
mariadb:
image: mariadb
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: mysql
options: >-
Expand Down
18 changes: 0 additions & 18 deletions .gitpod.yml

This file was deleted.

17 changes: 13 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.0
hooks:
- id: flake8
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.8
rev: v0.9.15
hooks:
- id: pymarkdown
args:
- --disable-rules
- line-length
- scan
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.19.0" # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, "5.0"] # Replace with Django version
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.

## Unreleased

## [1.2.0] - 2024-07-13

- Upgrade for Wagtail 6.1 & Django 5.0
- Upgrade for Wagtail 5.2+ & Django 4.2+
- Update pr-commit config
- Fix typo in docs

## [1.1.0] - 2023-02-12

- Drop older supported versions
Expand Down
14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ run:
python manage.py runserver 0:8000

mail:
cp tests/local.py.example tests/local.py
docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog

test:
python manage.py test
coverage run manage.py test && coverage report

tox:
tox --skip-missing-interpreters
Expand All @@ -15,13 +14,4 @@ migrate:
python manage.py migrate

superuser:
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', 'admin@admin.com', 'admin')" | python manage.py shell

dumpdata:
python manage.py dumpdata --indent 2 --natural-foreign \
-e wagtailsearch -e contenttypes -e wagtailcore.pagelogentry -e wagtailcore.groupcollectionpermission \
-e auth.permission -e wagtailcore.referenceindex -e auth.group -e wagtailcore.workflow \
-e sessions -e wagtailcore.workflowtask -e wagtailcore.pagesubscription -e wagtailcore.grouppagepermission \
-e wagtailcore.collection -e wagtailcore.workflowpage -e wagtailcore.task -e wagtailcore.groupapprovaltask \
-e wagtailredirects.redirect \
> tests/fixtures/dump.json
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', 'admin@admin.com', 'changeme')" | python manage.py shell
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Wagtail Honeypot

Use this package to add optional honeypot protection to your Wagtail forms.

![Alt text](docs/sample.jpg?raw=true "Title")

It should help to reduce form spam by tricking bots into submitting data in fields that should remain empty.
## Add optional form spam protection to your Wagtail forms

The package provides validation that a hidden text field that should remain empty and checks a time interval between the form being displayed and submitted.
It should help to reduce form spam by tricking bots into submitting data in fields that should remain empty.

## How it works
### How it works

When the Wagtail Form is submitted and the honeypot protection is enabled, the honeypot fields & values are available in the `POST` data.

It provides validation for a hidden text field that should remain empty and checks a time interval between the form being displayed and submitted.

If the form is submitted with content in the hidden field or before the interval expires the submission is ignored.

> No email is sent
No submission is stored
The thank you page is always shown if available.
- No email is sent
- No submission is stored

## Installation and setup

Expand Down Expand Up @@ -130,10 +129,9 @@ In your Wagtail site you should now be able to add a new form page, *enable the

Test that the honey pot field works

> View the newly created form page.
The honeypot field is visible and could be submitted with any value.
Test it out by submitting the form with the honeypot field set to any value.
It won't save the form submission or send an email if you have enabled that in your form page.
1. View the newly created form page.
2. The honeypot field is visible and could be submitted with any value.
3. Test it out by submitting the form with the honeypot field set to any value. It won't save the form submission or send an email if you have enabled that in your form page.

## Hide the Honeypot field

Expand Down Expand Up @@ -174,9 +172,9 @@ The field should be visibly hidden and not be available to receive any value fro

Wagtail honey pot can be used in environments:

- Python 3.7+
- Django 3.2+
- Wagtail 4.1+
- Python 3.9+
- Django 4.2+
- Wagtail 5.1+

## Contributions

Expand Down
13 changes: 8 additions & 5 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

## Development Setup

There is a [testapp](../tests/testapp/) provided that is a fully configured minimal setup using Wagtail v4.2
With a virtual environment activated, install the package in editable mode:

```bash
pip install -e ".[development]"
```

There is a [testapp](../tests/testapp/) provided that is a fully configured minimal setup using Wagtail v5.1+

Setup the app:

Expand All @@ -26,8 +32,6 @@ make run

View the site at `http://localhost:8000` or add `/admin` to login.

> You can see if emails are sent or not via the console.
### A convenient SMTP server

If you have docker and docker-compose installed
Expand All @@ -36,8 +40,7 @@ If you have docker and docker-compose installed
make mail
```

> Will spin up a Mailhog instance and simulate a `real` email inbox.
and will add a local.py file to settings in the test app settings with the correct EMAIL_BACKEND and credentials
> Will spin up a Mailhog instance and simulate a `real` email inbox.
View the Mailhog app in your browser at `http://localhost:8025`

Now when you submit the form with settings to send the notification email you will see the email in the Mailhog inbox
Expand Down
Loading

0 comments on commit 42e93d7

Please sign in to comment.