Skip to main content

Authentication using email only

Project description

settings.py:

INSTALLED_APPS = [
    ...
    'django_auth_email',
    ...
]

And run command:

./manage.py makemigrations django_auth_email
./manage.py migrate

Will be create a table in the DB – django_auth_email_option. Model:

class Option(models.Model):
    user = models.ForeignKey(User)
    code = models.CharField(max_length=56)
    expiry = models.DateTimeField()

Sign-in/up:

>>> from django_auth_email.models import DEAMng
>>> auth = DEAMng()
>>> code = auth.set_code(form.instance.email)
>>> print(code)
c0fca3619e2a0692a0f7bc79388cc51b5c805b22f5718e342bafd986

Authorization:

>>> check = DEAMng()
>>> if check.is_valid(code):
>>>     auth.login(request, check.get_user())
>>>     check.clean_dea()

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-auth-email-0.0.1a4.tar.gz (2.6 kB view hashes)

Uploaded Source

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