-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from nickmoreton/release-1.0.0
Support Wagtail 4
- Loading branch information
Showing
52 changed files
with
2,488 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[flake8] | ||
# E501: Line too long | ||
# W503: line break before binary operator (superseded by W504 line break after binary operator) | ||
ignore = E501,W503 | ||
exclude = migrations,node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
/node_modules | ||
/test-static | ||
/test-media | ||
/sandbox/sandbox/settings/local.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
repos: | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/psf/black | ||
rev: 22.6.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 5.0.4 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/jackdewinter/pymarkdown | ||
rev: main | ||
hooks: | ||
- id: pymarkdown | ||
args: | ||
- --disable-rules | ||
- line-length | ||
- scan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
run: | ||
@echo "Running sandbox..." | ||
python sandbox/manage.py runserver 0:8000 | ||
|
||
mail: | ||
@echo "Running sandbox mail..." | ||
cp sandbox/sandbox/settings/local.py.example.py sandbox/sandbox/settings/local.py | ||
docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog | ||
|
||
test: | ||
python testmanage.py test | ||
|
||
tox: | ||
tox --skip-missing-interpreters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Configuration | ||
|
||
Honeypot protection is a way to trick bots into submitting data in fields that should remain empty when submitted by a website visitor. | ||
|
||
The package provides a text field that should remain empty. If the form is submitted with a value in this field the submission is ignored. | ||
|
||
## Honeypot Text Field | ||
|
||
This is how the default honeypot text field is rerendered. | ||
|
||
```html | ||
<input type="text" name="whf_name" id="whf_name" data-whf_name="" tabindex="-1" autocomplete="off"> | ||
``` | ||
|
||
You can change the text field name by adding the following to your settings. | ||
|
||
```python | ||
HONEYPOT_NAME = "your-field-name" | ||
``` | ||
|
||
It also provides a time field and checks a time interval between the form being displayed and submitted. | ||
|
||
The default interval is 3 seconds. If the form is submitted before the interval expires the submission is ignored. | ||
|
||
### Honeypot Time Field | ||
|
||
This is how the default honeypot time field is rerendered. | ||
|
||
```html | ||
<input type="hidden" name="whf_time" id="whf_time" data-whf_name="" tabindex="-1" autocomplete="off"> | ||
``` | ||
|
||
You can change the time field name by adding the following to your settings. | ||
|
||
```python | ||
HONEYPOT_TIME = "your-field-name" | ||
``` | ||
|
||
You can change the time interval by adding the following to your settings. | ||
|
||
```python | ||
HONEYPOT_INTERVAL = 1 # seconds | ||
``` | ||
|
||
## Development Setup | ||
|
||
There is a [sandbox](../sandbox/) app provided that is a fully configured minimal setup using Wagtail v4. | ||
|
||
It's already initialised with admin login details of Username: `admin` Password: `changeme` | ||
|
||
To run the sandbox run `make run` and view the site at `http://localhost:8000` or add `/admin` to login. | ||
|
||
You can see if emails are sent or not via the console. | ||
|
||
### It's sometimes convenient to send emails via a SMTP server | ||
|
||
If you have docker and docker-compose installed | ||
|
||
- run `make mail` to spin up a Mailhog instance and simulate a `real` email inbox. | ||
- view the Mailhog app in your browser at `http://localhost:8025` | ||
- running this command will add a local.py file to settings in hte sandbox app with the correct EMAIL_BACKEND and credentials |
Oops, something went wrong.