An open API service indexing awesome lists of open source software.

https://github.com/zeioth/django-dual-authentication

Allows authentication with either a username or an email address.
https://github.com/zeioth/django-dual-authentication

Last synced: over 1 year ago
JSON representation

Allows authentication with either a username or an email address.

Awesome Lists containing this project

README

          

`Django-dual-authentication `__
==========================

.. image:: https://img.shields.io/pypi/v/django-dual-authentication.svg
:target: https://pypi.python.org/pypi/django-dual-authentication/

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://github.com/Zeioth/django-dual-authentication/blob/master/LICENSE

This package allows to authenticate a user with either a username an
email address, or both. It overrides
`Django `__ authenticate method, so it
should work in almost any case of use, without touch anything else.

Supported versions:

- Python >= 2.7
- Django >= 1.5

Installation
------------

Run::

pip install django-dual-authentication

Then, add this line to your settings.py::

AUTHENTICATION_BACKENDS = ['django-dual-authentication.backends.DualAuthentication']

Quick and painless, right?

Settings
--------

- ``AUTHENTICATION_METHOD``: You can authenticate your users by
``'username'``, ``'email'``, ``'both'``. Default: ``'both'``.
- ``AUTHENTICATION_CASE_SENSITIVE``: You can choose ``'username'``,
``'email'``, ``'both'``, ``'none'``. Default: ``'username'``.

Common issues
-------------

We've been reported about users having problems with MySQL and
dual-authentication case sensitive option. This is because `mysql is
case-insensitive by
default `__.
So, if you need case sensitive authentication, probably you'd prefer
avoid this database engine.

Also, note that if you combine certain options like
``AUTHENTICATION_METHOD = 'username'`` and
``AUTHENTICATION_CASE_SENSITIVE = 'username'``, then might be a good
idea check if a not case sensitive user already exists, for your
registation form's username field. Other way, users having the same
username with different capital letters, will not be able to login, for
obvious reasons.

Finally, note that ``'email'`` and ``'both'``, are meant for very specific border cases. All email adresses of the internet are case insensitive, so it's recommended to use the values ``'none'`` or ``'username'``.

Testing
-------

- Clone this repository.
- Open testproject directory.
- Run syncdb or migrate depending your django version, and runserver.
- Open http://localhost:8000/admin/ and try to login.

Updates
-----------

- Dec 2014: Stable release
- Dec 2015: All it's working fine. No changes.
- Dec 2016: All it's working fine. No changes.
- Dec 2017: All it's working fine. No changes.
- Dec 2018: All it's working fine. No changes.
- Apr 2019: Added support for django 2.0+ and Python 3.7.
- Jul 2020: All it's working fine. No changes.
- sep 2021: All it's working fine. No changes.
- Jun 2022: All it's working fine. No changes.
- Jan 2023: All it's working fine. No changes.
- Jan 2024: All it's working fine. No changes.