Code Monkey home page Code Monkey logo

django-password-required's Introduction

Django Password Required

A reusable Django app for requiring a password to access some pages on a site, without requiring users to register an account.

This is a very simple method of authentication, and is intended to provide a low barrier of entry to a site that is not completely public.

Use cases could be previews of sites that users are not supposed to log in to, Stack Overflow-style beta tests, etc.

Using the @password_required decorator, you can password-protect individual views.

This module is based on simple session variables, and thus interoperable with django.contrib.auth, allowing you to optionally bypass password protection for all authenticated users, or only for certain groups.

Usage

  1. Install the app.
    Not really within the scope of this document, but if you have pip installed, you could do something like this:

    pip install -e git+git://github.com/mikl/django-password-required.git#egg=password_required

    If you are developing multiple Django sites, you should probably use virtualenv to keep their dependencies separate.

  2. Add password_required to INSTALLED_APPS in your Django settings file.

  3. Set PASSWORD_REQUIRED_PASSWORD to the preferred password in your Django settings file. Example:

    PASSWORD_REQUIRED_PASSWORD = 'mysecretpassword'

  4. Add the password required login page to your URLconf. Example:

    (r'^password_required/$', 'password_required.views.login'),

  5. Apply the @password_required decorator to your views like in this final code example.

    from password_required.decorators import password_required [...more imports...]

    @password_required def my_awesome_view(request): [...view code here...]

Requirements

This app requires Django 1.2 or later.

License

This app is BSD-licensed, just like Django.

Development, support and feedback

If you have problems, find a bug or have other feedback, please file an issue on the main Github repo.

django-password-required's People

Contributors

mikl avatar ttimo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.