Skip to content

ptvirgo/django_user_extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Some Django User Extensions

I anticipate regularly needing a few common extensions to the standard django.contrib.auth model. They are unified here.

In particular:

  • google-recaptcha should prevent bot attempts to register users or alter passwords
  • users can specify their timezones
  • django context gets a user JWT

Installation

Install

Add to your Django setup

INSTALLED_APPS = [ # ...
    'captcha',
    'user_extensions'

#...
]

TEMPLATES = [{ #...
    'DIRS': [ #...
              os.path.join(BASE_DIR, 'user_extensions/templates')
    #...
    ]

    'OPTIONS': {
        'context_processors': [ # ...
            'user_extensions.context_processors.add_jwt',
    #...
    ]
# ...

MIDDLEWARE = [ # ...
    'user_extensions.middleware.TimezoneMiddleware']

USER_EXTENSIONS = {
    'JWT_TIMEOUT': timedelta(minutes=???), # pick a number
    'JWT_ALGORITHM': 'HS256'
}

# Google Recaptcha Integration
NOCAPTCHA = True
RECAPTCHA_PUBLIC_KEY = ???
RECAPTCHA_PRIVATE_KEY = ???

About

Some extensions to the standard django user.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published