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
------------
1. Install python library using pip: pip install django-cerberus
2. Add ``cerberus`` to ``INSTALLED_APPS`` in your Django settings file
3. 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.
Authors
-------
Library is by `Erik Telepovsky` from `Pragmatic Mates`_. See `our other libraries`_.
.. _Pragmatic Mates: http://www.pragmaticmates.com/
.. _our other libraries: https://github.com/PragmaticMates
Raw data
{
"_id": null,
"home_page": "https://github.com/PragmaticMates/django-cerberus",
"name": "django-cerberus",
"maintainer": "Pragmatic Mates",
"docs_url": null,
"requires_python": null,
"maintainer_email": "info@pragmaticmates.com",
"keywords": "django login auth cerberus",
"author": "Pragmatic Mates",
"author_email": "info@pragmaticmates.com",
"download_url": "https://files.pythonhosted.org/packages/98/ad/8543d973ad2080d8d8ea389d4f4f18c98e8d4d021aea4e94454f8d1c05ff/django_cerberus-1.0.1.tar.gz",
"platform": null,
"description": "django-cerberus\n===============\n\nDjango app that locks out users after too many failed login attempts until release time expires.\n\nTested on Django 1.4.5.\n\n\nRequirements\n------------\n- Django\n\n\nInstallation\n------------\n\n1. Install python library using pip: pip install django-cerberus\n\n2. Add ``cerberus`` to ``INSTALLED_APPS`` in your Django settings file\n\n3. Sync your database\n\n\nUsage\n-----\n\nAdd ``cerberus.decorators.watch_logins`` decorator to your login view. Example::\n\n\n class LoginView(FormView):\n template_name = 'example/login.html'\n form_class = AuthenticationForm\n\n @method_decorator(watch_logins)\n def dispatch(self, request, *args, **kwargs):\n if request.user.is_authenticated():\n return redirect(settings.LOGIN_REDIRECT_URL)\n return super(LoginView, self).dispatch(request, *args, **kwargs)\n\n def form_valid(self, form):\n user = form.get_user()\n login(self.request, user)\n return super(LoginView, self).form_valid(form)\n\n def get_success_url(self):\n return reverse('logged_in')\n\n\nSettings\n''''''''\n\nCERBERUS_MAX_ATTEMPTS\n Number of max failed login attempt. Default: ``5``.\n\nCERBERUS_LOCKOUT_TIME\n Number of seconds after the failed login attempts are forgotten in seconds. Default: ``600``.\n\n\nModel\n'''''\nEach lockout model instance contains username, number of failed login attempts, IP address, user agent details,\nGET and POST parameters, information if lockout is locked (user tried to log in with wrong credentials at least\n``CERBERUS_MAX_ATTEMPTS`` times) and if lockout is expired (based on ``CERBERUS_LOCKOUT_TIME``).\n\n\nTemplate\n''''''''\nYou can override ``cerberus/lockout.html`` template if you wish. There is ``lockout`` instance and ``lockout_time`` variable\n(CERBERUS_LOCKOUT_TIME) available in template context.\n\n\nAuthors\n-------\n\nLibrary is by `Erik Telepovsky` from `Pragmatic Mates`_. See `our other libraries`_.\n\n.. _Pragmatic Mates: http://www.pragmaticmates.com/\n.. _our other libraries: https://github.com/PragmaticMates\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "Django app that locks out users after too many failed login attempts.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/PragmaticMates/django-cerberus"
},
"split_keywords": [
"django",
"login",
"auth",
"cerberus"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "98ad8543d973ad2080d8d8ea389d4f4f18c98e8d4d021aea4e94454f8d1c05ff",
"md5": "d53831e3d0b6f92dcbf20bb3754d14ec",
"sha256": "c69ba985eec7a2319cfb65e2859fe926cafd4363793160554d595baf2648a417"
},
"downloads": -1,
"filename": "django_cerberus-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d53831e3d0b6f92dcbf20bb3754d14ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6455,
"upload_time": "2024-11-22T09:36:57",
"upload_time_iso_8601": "2024-11-22T09:36:57.233948Z",
"url": "https://files.pythonhosted.org/packages/98/ad/8543d973ad2080d8d8ea389d4f4f18c98e8d4d021aea4e94454f8d1c05ff/django_cerberus-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 09:36:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PragmaticMates",
"github_project": "django-cerberus",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "django-cerberus"
}