gogobook / django-captcha-admin

Simple way to add a ReCaptcha field to your admin login page.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django Captcha Admin

Simple way to add a ReCaptcha field to your admin login page.

4 simple steps

  1. Install django-captcha-admin from pypi:

    $> pip install django-captcha-admin
  2. Add captcha_admin and captcha to your INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'captcha_admin',
        'captcha',
    )
  3. Add your captcha keys to your settings, the way django-recaptcha indicates:

    RECAPTCHA_PUBLIC_KEY = 'your-public-key'
    RECAPTCHA_PRIVATE_KEY = 'your-private-key'
    # If I'm not a Robot is required add:
    NOCAPTCHA = True
  4. Edit your code so instead of importing admin from django.contrib, you import it from captcha_admin:

    from captcha_admin import admin
    
    # This should stay the same
    admin.autodiscover()
    
    urlpatterns = patterns(
        ...
        url(r'^admin/', include(admin.site.urls)),  # and this...
        ...
    )
  5. For routine login, you can import loginView from captcha_admin:

    from captcha_admin.views import loginView
    
    urlpatterns = patterns(
        ...
        url(r'^accounts/login/', LoginView.as_view()),
        ...
    )

That's it!

About

Simple way to add a ReCaptcha field to your admin login page.

License:MIT License


Languages

Language:Python 58.6%Language:HTML 41.4%