django-cerberus
Django app that locks out users after too many failed login attempts until release time expires.
Tested on Django 1.4.5.
Requirements
Django
Installation
Install python library using pip: pip install django-cerberus
Add cerberus to INSTALLED_APPS in your Django settings file
Sync your database
Usage
Add cerberus.decorators.watch_logins decorator to your login view. Example:
class LoginView(FormView):
template_name = 'example/login.html'
form_class = AuthenticationForm
@method_decorator(watch_logins)
def dispatch(self, request, *args, **kwargs):
if request.user.is_authenticated():
return redirect(settings.LOGIN_REDIRECT_URL)
return super(LoginView, self).dispatch(request, *args, **kwargs)
def form_valid(self, form):
user = form.get_user()
login(self.request, user)
return super(LoginView, self).form_valid(form)
def get_success_url(self):
return reverse('logged_in')
Settings
- CERBERUS_MAX_ATTEMPTS
Number of max failed login attempt. Default: 5.
- CERBERUS_LOCKOUT_TIME
Number of seconds after the failed login attempts are forgotten in seconds. Default: 600.
Model
Each lockout model instance contains username, number of failed login attempts, IP address, user agent details, GET and POST parameters, information if lockout is locked (user tried to log in with wrong credentials at least CERBERUS_MAX_ATTEMPTS times) and if lockout is expired (based on CERBERUS_LOCKOUT_TIME).
Template
You can override cerberus/lockout.html template if you wish. There is lockout instance and lockout_time variable (CERBERUS_LOCKOUT_TIME) available in template context.
Metadata
Release files for django-cerberus 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_cerberus-1.0.1.tar.gz | 6.5 kB | Without provenance | Details for django_cerberus-1.0.1.tar.gz |
Release files / django_cerberus-1.0.1.tar.gz
| Download URL | django_cerberus-1.0.1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c69ba985eec7a2319cfb65e2859fe926cafd4363793160554d595baf2648a417
|
|
BLAKE2b-256 checksum How to use checksums |
98ad8543d973ad2080d8d8ea389d4f4f18c98e8d4d021aea4e94454f8d1c05ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for django-cerberus 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.