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',
# ...
]
# if set then users age will be validated for minimal age (in years)
USER_MINIMAL_AGE = int(os.environ.get('USER_MINIMAL_AGE', None))
# if set, an used address canot be save with non verified phone number
ENFORCE_USER_ADDRESS_VERIFIED_PHONE = int(os.environ.get('ENFORCE_USER_ADDRESS_VERIFIED_PHONE', False))
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-user-email-extension-2.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f983759d9af7db7f3fbd53a44180ad584981ed0874945a9cd1ff98fd3371620e |
|
MD5 | 425feee2887a31025af7fd842e72cb14 |
|
BLAKE2b-256 | 19dd445f6151e7939faf7315b5866f92a479db42af77228fa6f0de369fbe4085 |
Close
Hashes for django_user_email_extension-2.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 431c6b637977afda1f46946e3e49333f5e02d064c2a8098393939831be2060fb |
|
MD5 | 3e7ad8317b3bdc1b34ea86330e8e0696 |
|
BLAKE2b-256 | 2f2dced48a63c9b9da487f262580c35616ee1a4dddf04b196dcd20211f357982 |