Skip to main content

User model extender for django

Project description

Django-User-Email-Extension

Django application that extends User module, and provides email verification process.

Install

pip install django-user-email-extension

Add to installed apps, and email provider details:

INSTALLED_APPS = [
    # ...
    'django_user_email_extension',
    # ...
]

EMAIL_USE_TLS = True
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.environ.get('email_host')
EMAIL_PORT = os.environ.get('email_port')
EMAIL_HOST_USER = os.environ.get('email_username')
EMAIL_HOST_PASSWORD = os.environ.get('email_password')

Run migrations:

python3 manage.py makemigrations python3 manage.py migrate

Optional:

add to settings.py, if not set, verification email will never expire.

    # ...
    DJANGO_EMAIL_VERIFIER_EXPIRE_TIME = 24  # In Hours
    # ...

Usage Example

use:

from django_user_email_extension.models import *

user_object = User.objects.create_user('EMAIL', 'PASSWORD')

# user is a Django User object
user_object.create_verification_email()

# Send the verification email
user_object.send_verification_email(subject=subject,
                                 body=body,
                                 from_mail=EMAIL_HOST_USER)

# Initiate verification process
verify_record(uuid_value=uuid)

The confirmation uuid can be sent as part of the body for example:

    body = 'Follow this link to verify your account: https://nalkins.cloud' + \
           '%s' % reverse('verify_account',
                          kwargs={'uuid': str(user_object.get_uuid_of_email())})

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

django-user-email-extension-0.1.9.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-user-email-extension-0.1.9.tar.gz.

File metadata

  • Download URL: django-user-email-extension-0.1.9.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for django-user-email-extension-0.1.9.tar.gz
Algorithm Hash digest
SHA256 09c7da2f3c44bb9bf29bd978616275ed6c6bd7b4f0b3e5e7646a716e9bfdc7c9
MD5 935a54b07903ac33d91b51b7da0316f5
BLAKE2b-256 4fd666b3b804c8566d670acd44837c45dc67ae67bca68f27590a927e728a84b0

See more details on using hashes here.

Provenance

File details

Details for the file django_user_email_extension-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: django_user_email_extension-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for django_user_email_extension-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9cb07c30460d7277a250faac0b3b3d40e7cb9f649cbc5ea57c6bee1700b155ff
MD5 5770dfd3c5e500b6f53253ffbfe65208
BLAKE2b-256 40a592e201174483ba976c6dae0c63588edd1fe6989a53327cdab4f91e744d4a

See more details on using hashes here.

Provenance

Supported by

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