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.
- Python >= 2.7
- Django >= 1.5
pip install django-dual-authentication
Then, add this line to your settings.py:
AUTHENTICATION_BACKENDS = ['django-dual-authentication.backends.DualAuthentication']
Quick and painless, right?
AUTHENTICATION_METHOD: You can authenticate your users by
AUTHENTICATION_CASE_SENSITIVE: You can choose
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
'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
- 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.
- 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.