为django登录表单添加HashCash.IO "工作量证明"控制。
项目描述
django-hashcash
===============
此项目将http://hashcash.io实现到正常的Django登录表单中。
这很有用,因为它可能可以阻止对登录表单的暴力攻击。
安装
------------
### 1. 获取应用程序: `pip install django-hashcash`
### 2. 更新settings.py
````
# settings.py
...
#
# 将django_hashcash安装到INSTALLED_APPS
#
INSTALLED_APPS += (
'django_hashcash',
)
...
#
# 添加从https://hashcash.io/获取的详细信息
#
HASHCASHIO_PUBLIC_KEY = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
HASHCASHIO_PRIVATE_KEY = 'PRIVATE-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
...
````
### 3. 更新urls.py
````
# urls.py
...
from django_hashcash.forms import HashCashAuthenticationForm
...
admin.autodiscover()
admin.site.login_template = 'django_hashcash/login.html'
admin.site.login_form = HashCashAuthenticationForm
...
````
### 完成!
===============
此项目将http://hashcash.io实现到正常的Django登录表单中。
这很有用,因为它可能可以阻止对登录表单的暴力攻击。
安装
------------
### 1. 获取应用程序: `pip install django-hashcash`
### 2. 更新settings.py
````
# settings.py
...
#
# 将django_hashcash安装到INSTALLED_APPS
#
INSTALLED_APPS += (
'django_hashcash',
)
...
#
# 添加从https://hashcash.io/获取的详细信息
#
HASHCASHIO_PUBLIC_KEY = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
HASHCASHIO_PRIVATE_KEY = 'PRIVATE-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
...
````
### 3. 更新urls.py
````
# urls.py
...
from django_hashcash.forms import HashCashAuthenticationForm
...
admin.autodiscover()
admin.site.login_template = 'django_hashcash/login.html'
admin.site.login_form = HashCashAuthenticationForm
...
````
### 完成!