Skip to main content

Django app for user authentication

Project description

This code a frictionless signup Django app.

The app will register and login a user with as little as only an email address.

When the user logs out and tries to logs back in with the same email address, the app will first verify the email address through an activation url send to the registered email address. Setting the password is deferred to after the email address has been verified.

If during the first login and/or subsequent login, the email address should be verified before moving forward (ex: before presenting a payment view), you should decorate the view with an active_required decorator.

This project contains bare bone templates which are compatible with Django and Jinja2 template engines. To see djaodjin-signup in action as part of a full-fledged subscription-based session proxy, take a look at djaoapp.

Install

Add the signup urls to your urlpatterns and EmailOrUsernameModelBackend to the settings AUTHENTICATION_BACKENDS.

urls.py:

    urlpatterns = ('',
        (r'^api/', include('signup.urls.api')),
        (r'^', include('signup.urls.views')),

    )

settings.py:

    AUTHENTICATION_BACKENDS = (
        'signup.backends.auth.EmailOrUsernameModelBackend',
        'django.contrib.auth.backends.ModelBackend'

    )

To make the application useable accross a variety of websites, signup never sends any e-mails directly. It relies on triggering signals whenever a notification must be generated. As a result, to verify a user email address and activate her account, you will need to implement a listener for the user_verification signal and send the e-mail from there.

Development

After cloning the repository, create a virtualenv environment, install the prerequisites, create and load initial data into the database, then run the testsite webapp.

$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r testsite/requirements.txt
$ make vendor-assets-prerequisites
$ make initdb
$ python manage.py runserver

# Browse http://localhost:8000/

Release Notes

Tested with

  • Python: 3.7, Django: 3.2 (LTS)
  • Python: 3.10, Django: 4.2 (latest) - see #55
  • Python: 2.7, Django: 1.11 (legacy) - use testsite/requirements-legacy.txt

0.8.4

  • hotfix: field_value is undefined

0.8.3

  • removes connection btw user and contact on delete
  • fixes activation with e-mail that looks like a bot
  • verifies and activates contact with no user
  • restores workflow to recover password from an e-mail

previous release notes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djaodjin-signup-0.8.4.tar.gz (89.9 kB view details)

Uploaded Source

Built Distribution

djaodjin_signup-0.8.4-py3-none-any.whl (143.2 kB view details)

Uploaded Python 3

File details

Details for the file djaodjin-signup-0.8.4.tar.gz.

File metadata

  • Download URL: djaodjin-signup-0.8.4.tar.gz
  • Upload date:
  • Size: 89.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for djaodjin-signup-0.8.4.tar.gz
Algorithm Hash digest
SHA256 918cacb8d102f3fa0f671779080949fcd8d91370dd6eaf800aa4a1d769850883
MD5 212d5235e4f1db467c372c97c3623a75
BLAKE2b-256 929c60fbf78e7c62bffbe0e99ca901b8bfd90ce1affe2d5d57298eee5a590610

See more details on using hashes here.

File details

Details for the file djaodjin_signup-0.8.4-py3-none-any.whl.

File metadata

File hashes

Hashes for djaodjin_signup-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 52d251c1a900b9f41820008cf2742aeb1285b37e2abd0758bd736ff2d106e820
MD5 e24de66d71c5f531c29634fcda38111a
BLAKE2b-256 f9add440cf281ebd18dcfa076a12f7a94683e0d5ac115e146e0a34fa84333c7b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page