• Stars
    star
    211
  • Rank 186,867 (Top 4 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom user model for django >=1.5 with support for multiple user types.

django-users2

http://img.shields.io/travis/mishbahr/django-users2.svg?style=flat-square Latest Version Downloads License http://img.shields.io/coveralls/mishbahr/django-users2.svg?style=flat-square

Custom user model for django >=1.5 with support for multiple user types and lots of other awesome utils (mostly borrowed from other projects). If you are using django < 1.11, please install v0.2.1 or earlier (pip install django-users2<=0.2.1).

Features

  • email as username for authentication (barebone extendable user models)
  • support for multiple user types (using the awesome django-model-utils)
  • automatically creates superuser after syncdb/migrations (really handy during the initial development phases)
  • built in emails/passwords validators (with lots of customisable options)
  • prepackaged with all the templates, including additional templates required by views in django.contrib.auth (for a painless signup process)

Documentation

The full documentation is at https://django-users2.readthedocs.org.

Quickstart

  1. Install django-users2:

    pip install django-users2
    
  2. Add django-users2 to INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'django.contrib.auth',
        'django.contrib.sites',
        'users',
        ...
    )
    
  3. Set your AUTH_USER_MODEL setting to use users.User:

    AUTH_USER_MODEL = 'users.User'
    
  4. Once youโ€™ve done this, run the migrate command to install the model used by this package:

    python manage.py migrate
    
  5. Add the django-users2 URLs to your projectโ€™s URLconf as follows:

    urlpatterns = patterns('',
        ...
        url(r'^accounts/', include('users.urls')),
        ...
    )
    

which sets up URL patterns for the views in django-users2 as well as several useful views in django.contrib.auth (e.g. login, logout, password change/reset)

Configuration

Set USERS_VERIFY_EMAIL = True to enable email verification for registered users.

When a new User object is created, with its is_active field set to False, an activation key is generated, and an email is sent to the user containing a link to click to activate the account:

USERS_VERIFY_EMAIL = False

Upon clicking the activation link, the new account is made active (i.e. is_active field is set to True); after this, the user can log in. Optionally, you can automatically login the user after successful activation:

USERS_AUTO_LOGIN_ON_ACTIVATION = True

This is the number of days the users will have, to activate their accounts after registering:

USERS_EMAIL_CONFIRMATION_TIMEOUT_DAYS = 3

Automatically create django superuser after syncdb, by default this option is enabled when settings.DEBUG = True.

You can customise the email/password by overriding USERS_SUPERUSER_EMAIL and USERS_SUPERUSER_PASSWORD settings (highly recommended):

USERS_CREATE_SUPERUSER = settings.DEBUG
USERS_SUPERUSER_EMAIL = '[email protected]'
USERS_SUPERUSER_PASSWORD = 'django'

Prevent automated registration by spambots, by enabling a hidden (using css) honeypot field:

USERS_SPAM_PROTECTION = True

Prevent user registrations by setting USERS_REGISTRATION_OPEN = False:

USERS_REGISTRATION_OPEN = True

Settings for validators, that check the strength of user specified passwords:

# Specifies minimum length for passwords:
USERS_PASSWORD_MIN_LENGTH = 5

#Specifies maximum length for passwords:
USERS_PASSWORD_MAX_LENGTH = None

Optionally, the complexity validator, checks the password strength:

USERS_CHECK_PASSWORD_COMPLEXITY = True

Specify number of characters within various sets that a password must contain:

USERS_PASSWORD_POLICY = {
        'UPPER': 0,       # Uppercase 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
        'LOWER': 0,       # Lowercase 'abcdefghijklmnopqrstuvwxyz'
        'DIGITS': 0,      # Digits '0123456789'
        'PUNCTUATION': 0  # Punctuation """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
}

Allow/disallow registration using emails addresses from specific domains:

USERS_VALIDATE_EMAIL_DOMAIN = True

List of disallowed domains:

USERS_EMAIL_DOMAINS_BLACKLIST = []

For example, USERS_EMAIL_DOMAINS_BLACKLIST = ['mailinator.com'] will block all visitors from using mailinator.com email addresses to register.

List of allowed domains:

USERS_EMAIL_DOMAINS_WHITELIST = []

For example, USERS_EMAIL_DOMAINS_WHITELIST = ['ljworld.com'] will only allow user registration with ljworld.com domains.

More Repositories

1

django-modeladmin-reorder

Custom ordering for the apps and models in the admin app.
Python
257
star
2

awesome-django-cms

A curated list of awesome django-cms add-ons. You should also checkout: https://marketplace.django-cms.org/en/
210
star
3

djangocms-forms

The easiest and most flexible Django CMS Form builder โ€” Create forms quickly without ever touching code. Every field type you may need is available within a simple drag and drop interface.
Python
122
star
4

django-responsive2

django-responsive2 is an experimental Django app that gives web designers tools for building responsive websites. It can dynamically swap content based on breakpoints.
Python
34
star
5

django-usersettings2

The missing extension to the Django โ€œsitesโ€ framework, use it to store additional information for your Django-powered sites.
Python
32
star
6

djangocms-youtube

YouTube embed plugin for your django-cms powered site with options for custom video thumbnails, analytics, SEO and more.
JavaScript
25
star
7

djangocms-instagram

A simple but versatile Instagram plugin for your django-cms powered sites.
Python
23
star
8

django-connected

Connect your Django powered sites to social networks and other online services.
Python
22
star
9

djangocms-gmaps

The easiest way to embed Google Maps for your django-cms powered site. This is a great way to display the location of your business or event.
Python
22
star
10

djangocms-twitter2

The easiest way to display tweets for your django-cms powered site, using the latest Twitter 1.1 API. It's a great option for embedding tweets on your site without third-party widgets.
Python
12
star
11

djangocms-disqus

Disqus intergration for your django-cms powered site with options for Single Sign-On (SSO), lazy loading, analytics and more.
Python
8
star
12

djangocms-usersettings2

This projects integrates django-usersettings2 with django-cms >= 3.0
Python
8
star
13

djangocms-responsive-wrapper

This projects integrates https://github.com/mishbahr/django-responsive2 with django-cms >= 3.0
Python
6
star
14

djangocms-fbcomments

The easiest way to integrate Facebook Comments for your django-cms powered site with lazy-loading, analytics and more.
JavaScript
6
star
15

django-staticgen

Push your django powered site to Amazon S3.
Python
5
star
16

django-fwdform

Simple and painless form processing for static sites.
Python
3
star
17

staticgen-demo

Source for http://staticgen-demo.herokuapp.com
Python
3
star
18

djangocms-embed

Embed any content on the web. Powered by embed.ly.
Python
1
star
19

djangocms-layout

Produce a wonderful columned design in a matter of seconds โ€” [WIP]
Python
1
star