Skip to main content

Accounts is a Django app handles essential user security

  • Email verification upon register

  • Phone is enforced and mandatory “handled by Twilio sms service”

  • Device access location “handled by geoip2 and maxmind db”

  • Activity stream for user access

Indeed it is opinionated user app as follows:

  • User class is AbstractUser has a Profile foreign key

  • Profile with has fields like photo and date_of_birth

Check the docs for deep details.

Quick start

  1. Add “accounts” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'accounts',
    ]
    
    TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['accounts/templates'],
        ...
    }]
  2. Include the accounts URLconf in your project urls.py like this:

    path('accounts/',
    include(('accounts.urls', 'accounts'), namespace='auth'))
  • Note: mind the namespace as it is used in templates and testing.

  1. Set mandatory settings:

    # refers to the user model
    AUTH_USER_MODEL = 'accounts.User'
    MEDIA_ROOT = os.path.join(BASE_DIR, "media")
    MEDIA_URL = '/media/'
    # this is on-demand auth backends
    AUTHENTICATION_BACKENDS = [
        'accounts.authentication.EmailAuthBackend',
        'accounts.authentication.PhoneAuthBackend',
        'accounts.authentication.UsernameAuthBackend',
    ]
    # your favorite email backend
    # just for testing it is set to console
    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
    
    # maxmind db required
    # follow https://docs.djangoproject.com/en/3.1/ref/contrib/gis/geoip2/
    GEOIP_PATH = os.path.join(BASE_DIR, 'path/to/maxmind/db')
    
    # Twilio required sms validation
    # get keys from https://www.twilio.com/
    TWILIO_API_KEY = ""
    TWILIO_AUTH_TOKEN = ""
    TWILIO_PHONE_NUMBER = ""
  2. Run python manage.py migrate to create the accounts models.

  3. Start the development server and visit http://127.0.0.1:8000/accounts/login/

Metadata

Release files for django-secured-accounts 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-secured-accounts 1.0.2
File Size Uploaded
django-secured-accounts-1.0.2.tar.gz 17.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-secured-accounts 1.0.2
File Interpreter ABI Platform
django_secured_accounts-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.1 MB

Release files / django-secured-accounts-1.0.2.tar.gz

Download URL django-secured-accounts-1.0.2.tar.gz
Size 17.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a4c482431d0a27c2d1ff010b057cb8ba7aabddc8005f57437f5c3562d148604c
BLAKE2b-256 checksum
How to use checksums
413c4bd1078c3bdfeac059da72d442c191dff52e2dea595ee1a3fd846a862806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

Release files / django_secured_accounts-1.0.2-py3-none-any.whl

Download URL django_secured_accounts-1.0.2-py3-none-any.whl
Size 41.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e85b8dbcc16cc76fbbab7e4e06c6edfd65c910f3fcd7a5f2e5013d3695a3627d
BLAKE2b-256 checksum
How to use checksums
8b211fb8dd2df57a4d84fee0727fd936e0ee73eacd212e5944ebdeb0457bf483
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page