===============================
Django Multiple Authentication
===============================
.. image:: https://badge.fury.io/py/django-multiple-authentication.svg
:target: https://badge.fury.io/py/django-multiple-authentication
:alt: PyPi Status
.. image:: https://readthedocs.org/projects/django-multiple-authentication/badge/?version=latest
:target: https://django-multiple-authentication.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Django Multiple Authentication allows you to use either email or username field or any other
field on your user model for your user authentication.
Source code
https://github.com/KoredeDavid/django-multiple-authentication/
Documentation
https://django-multiple-authentication.readthedocs.io/en/latest/
-------------------------------------------------------------------------------
Rationale
----------------
Django's default authentication only accepts username for user authentication.
So the package allows you to use either email or username or any other stuff on your user table for user authentication.
It works with django's in-built authentication function, so
it works as long as django's authentication function is called.
Requirements
------------
* Python >= 3.6
* Django (3.0, 3.1, 3.2, 4.0, 4.1)
These are the officially supported python and django package versions. Other versions
will probably work.
Installation
-------------
Django Multiple Authentication can be installed with pip:
.. code-block:: console
pip install django
pip install django-multiple-authentication
Project Configuration
------------------------
Add ``multiple_auth`` to your list of ``INSTALLED_APPS`` in your ``settings.py`` :
.. code-block:: python
INSTALLED_APPS = [
...
"multiple_auth",
]
Now we tell django what ``AUTHENTICATION_BACKENDS`` we want to use for user authentication.
Update your ``settings.py`` with this:
.. code-block:: python
AUTHENTICATION_BACKENDS = (
'multiple_auth.backends.MultipleAuthentication',
)
Usage & Illustration
=====================
Startup up a new project like this if you haven't
.. code-block:: console
django-admin startproject sampleproject
cd sampleproject
python manage.py makemigrations
python manage.py migrate
Create a superuser
.. code-block:: console
python manage.py createsuperuser --username=test --email=test@email.com
It will bring a prompt to set ``password``. So just set your password and you're done creating a user.
Now we tell django what ``AUTHENTICATION_BACKENDS`` we want to use for user authentication.
Update your ``settings.py`` with this:
.. code-block:: python
AUTHENTICATION_BACKENDS = (
'multiple_auth.backends.MultipleAuthentication',
)
Add ``MULTIPLE_AUTH`` settings (a dictionary) to your settings.py. Include a key of ``auth_fields`` a value of the list of
field(s) in your User Model you want to accept for your authentication.
You can use one or more fields. For illustration,
we will be using the ``username`` and ``email`` fields. So update your settings like this:
.. code-block:: python
MULTIPLE_AUTH = {
'auth_fields': ['username', 'email']
}
You can test it with your login page or your API. It works also on the django-admin panel.
Note that the the ``auth_fields`` is not just limited two fields you can have one, two or more fields.
One Field:
.. code-block:: python
MULTIPLE_AUTH = {
'auth_fields': ['id']
}
Two OR More fields
.. code-block:: python
MULTIPLE_AUTH = {
'auth_fields': ['email', 'username', 'phone_number', 'id', ...]
}
.. figure:: https://raw.githubusercontent.com/KoredeDavid/django-multiple-authentication/development/docs/source/assets/gifs/webapp.gif
:alt: A GIF showing a user logging in with his ``email``, ``username`` and ``id``.
:align: center
*Here's a GIF showing a user logging in with his ``email``, ``username`` and ``id``.*
.. admonition:: NOTE
It also works with **Django Admin** and **REST APIs!!!**
Raw data
{
"_id": null,
"home_page": "https://github.com/korededavid/django-multiple-authentication",
"name": "django-multiple-authentication",
"maintainer": "Oluwashola David",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "koredeoluwashola@gmail.com",
"keywords": "django authenticate python authentication python login user username email django-multiple-auth multiple-auth multiple auth",
"author": "Oluwashola David",
"author_email": "koredeoluwashola@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8f/71/e1b60a64286e8b20343ad43cc63fc867c6a050b4b92c9f9b977093f5a408/django-multiple-authentication-2.0.5.tar.gz",
"platform": null,
"description": "===============================\nDjango Multiple Authentication\n===============================\n\n.. image:: https://badge.fury.io/py/django-multiple-authentication.svg\n :target: https://badge.fury.io/py/django-multiple-authentication\n :alt: PyPi Status\n\n.. image:: https://readthedocs.org/projects/django-multiple-authentication/badge/?version=latest\n :target: https://django-multiple-authentication.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\nDjango Multiple Authentication allows you to use either email or username field or any other\nfield on your user model for your user authentication.\n\nSource code\n https://github.com/KoredeDavid/django-multiple-authentication/\n\nDocumentation\n https://django-multiple-authentication.readthedocs.io/en/latest/\n\n-------------------------------------------------------------------------------\n\nRationale\n----------------\n\nDjango's default authentication only accepts username for user authentication.\nSo the package allows you to use either email or username or any other stuff on your user table for user authentication.\nIt works with django's in-built authentication function, so\nit works as long as django's authentication function is called.\n\nRequirements\n------------\n\n* Python >= 3.6\n* Django (3.0, 3.1, 3.2, 4.0, 4.1)\n\nThese are the officially supported python and django package versions. Other versions\nwill probably work.\n\nInstallation\n-------------\n\nDjango Multiple Authentication can be installed with pip:\n\n.. code-block:: console\n\n pip install django\n pip install django-multiple-authentication\n\nProject Configuration\n------------------------\n\nAdd ``multiple_auth`` to your list of ``INSTALLED_APPS`` in your ``settings.py`` :\n\n\n.. code-block:: python\n\n INSTALLED_APPS = [\n ...\n \"multiple_auth\",\n ]\n\n\nNow we tell django what ``AUTHENTICATION_BACKENDS`` we want to use for user authentication.\nUpdate your ``settings.py`` with this:\n\n.. code-block:: python\n\n AUTHENTICATION_BACKENDS = (\n 'multiple_auth.backends.MultipleAuthentication',\n )\n\n\nUsage & Illustration\n=====================\n\nStartup up a new project like this if you haven't\n\n.. code-block:: console\n\n django-admin startproject sampleproject\n\n cd sampleproject\n\n python manage.py makemigrations\n\n python manage.py migrate\n\nCreate a superuser\n\n.. code-block:: console\n\n python manage.py createsuperuser --username=test --email=test@email.com\n\nIt will bring a prompt to set ``password``. So just set your password and you're done creating a user.\n\nNow we tell django what ``AUTHENTICATION_BACKENDS`` we want to use for user authentication.\nUpdate your ``settings.py`` with this:\n\n.. code-block:: python\n\n AUTHENTICATION_BACKENDS = (\n 'multiple_auth.backends.MultipleAuthentication',\n )\n\nAdd ``MULTIPLE_AUTH`` settings (a dictionary) to your settings.py. Include a key of ``auth_fields`` a value of the list of\nfield(s) in your User Model you want to accept for your authentication.\n\nYou can use one or more fields. For illustration,\nwe will be using the ``username`` and ``email`` fields. So update your settings like this:\n\n.. code-block:: python\n\n MULTIPLE_AUTH = {\n 'auth_fields': ['username', 'email']\n }\n\nYou can test it with your login page or your API. It works also on the django-admin panel.\n\nNote that the the ``auth_fields`` is not just limited two fields you can have one, two or more fields.\n\nOne Field:\n\n.. code-block:: python\n\n MULTIPLE_AUTH = {\n 'auth_fields': ['id']\n }\n\n\nTwo OR More fields\n\n.. code-block:: python\n\n MULTIPLE_AUTH = {\n 'auth_fields': ['email', 'username', 'phone_number', 'id', ...]\n }\n\n\n.. figure:: https://raw.githubusercontent.com/KoredeDavid/django-multiple-authentication/development/docs/source/assets/gifs/webapp.gif\n :alt: A GIF showing a user logging in with his ``email``, ``username`` and ``id``.\n :align: center\n\n*Here's a GIF showing a user logging in with his ``email``, ``username`` and ``id``.*\n\n.. admonition:: NOTE\n\n It also works with **Django Admin** and **REST APIs!!!**\n",
"bugtrack_url": null,
"license": "MIT LICENCE",
"summary": "Enables developers to implement login with email or username or any other field on your user model in django",
"version": "2.0.5",
"split_keywords": [
"django",
"authenticate",
"python",
"authentication",
"python",
"login",
"user",
"username",
"email",
"django-multiple-auth",
"multiple-auth",
"",
"multiple",
"auth"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6999a750dcbcf06db6466d8c657b0624f2b9dd5be97081a4f49b45189178cf3a",
"md5": "a093fbdf8aeb3a877df8c0d918a366d9",
"sha256": "52dcfdd578f2bc2584f9b2930f0f3e13fc291a1bf429b0f207c89677bf4c537a"
},
"downloads": -1,
"filename": "django_multiple_authentication-2.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a093fbdf8aeb3a877df8c0d918a366d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6105,
"upload_time": "2023-01-25T09:05:45",
"upload_time_iso_8601": "2023-01-25T09:05:45.465954Z",
"url": "https://files.pythonhosted.org/packages/69/99/a750dcbcf06db6466d8c657b0624f2b9dd5be97081a4f49b45189178cf3a/django_multiple_authentication-2.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f71e1b60a64286e8b20343ad43cc63fc867c6a050b4b92c9f9b977093f5a408",
"md5": "4fcfdeb0d4f91f5fe2796bdb4c2eb56d",
"sha256": "1d0a69b102edbc4c9bbae11f9be342c1634d69e40885170382a7931767fdb540"
},
"downloads": -1,
"filename": "django-multiple-authentication-2.0.5.tar.gz",
"has_sig": false,
"md5_digest": "4fcfdeb0d4f91f5fe2796bdb4c2eb56d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5129,
"upload_time": "2023-01-25T09:05:47",
"upload_time_iso_8601": "2023-01-25T09:05:47.460498Z",
"url": "https://files.pythonhosted.org/packages/8f/71/e1b60a64286e8b20343ad43cc63fc867c6a050b4b92c9f9b977093f5a408/django-multiple-authentication-2.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-25 09:05:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "korededavid",
"github_project": "django-multiple-authentication",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "alabaster",
"specs": [
[
"==",
"0.7.12"
]
]
},
{
"name": "asgiref",
"specs": [
[
"==",
"3.5.2"
]
]
},
{
"name": "Babel",
"specs": [
[
"==",
"2.11.0"
]
]
},
{
"name": "backports.zoneinfo",
"specs": [
[
"==",
"0.2.1"
]
]
},
{
"name": "bleach",
"specs": [
[
"==",
"5.0.1"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2022.9.14"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"2.1.1"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "commonmark",
"specs": [
[
"==",
"0.9.1"
]
]
},
{
"name": "Django",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "docutils",
"specs": [
[
"==",
"0.17.1"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.4"
]
]
},
{
"name": "imagesize",
"specs": [
[
"==",
"1.4.1"
]
]
},
{
"name": "importlib-metadata",
"specs": [
[
"==",
"4.12.0"
]
]
},
{
"name": "jaraco.classes",
"specs": [
[
"==",
"3.2.2"
]
]
},
{
"name": "Jinja2",
"specs": [
[
"==",
"3.1.2"
]
]
},
{
"name": "keyring",
"specs": [
[
"==",
"23.9.3"
]
]
},
{
"name": "MarkupSafe",
"specs": [
[
"==",
"2.1.1"
]
]
},
{
"name": "more-itertools",
"specs": [
[
"==",
"8.14.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"22.0"
]
]
},
{
"name": "pkginfo",
"specs": [
[
"==",
"1.8.3"
]
]
},
{
"name": "Pygments",
"specs": [
[
"==",
"2.13.0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2022.7"
]
]
},
{
"name": "pywin32-ctypes",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "readme-renderer",
"specs": [
[
"==",
"37.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.28.1"
]
]
},
{
"name": "requests-toolbelt",
"specs": [
[
"==",
"0.9.1"
]
]
},
{
"name": "rfc3986",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"12.5.1"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "snowballstemmer",
"specs": [
[
"==",
"2.2.0"
]
]
},
{
"name": "Sphinx",
"specs": [
[
"==",
"5.3.0"
]
]
},
{
"name": "sphinx-rtd-theme",
"specs": [
[
"==",
"1.1.1"
]
]
},
{
"name": "sphinxcontrib-applehelp",
"specs": [
[
"==",
"1.0.2"
]
]
},
{
"name": "sphinxcontrib-devhelp",
"specs": [
[
"==",
"1.0.2"
]
]
},
{
"name": "sphinxcontrib-htmlhelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-jsmath",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "sphinxcontrib-qthelp",
"specs": [
[
"==",
"1.0.3"
]
]
},
{
"name": "sphinxcontrib-serializinghtml",
"specs": [
[
"==",
"1.1.5"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.2"
]
]
},
{
"name": "twine",
"specs": [
[
"==",
"4.0.1"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.3.0"
]
]
},
{
"name": "tzdata",
"specs": [
[
"==",
"2022.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"1.26.12"
]
]
},
{
"name": "webencodings",
"specs": [
[
"==",
"0.5.1"
]
]
},
{
"name": "zipp",
"specs": [
[
"==",
"3.8.1"
]
]
}
],
"lcname": "django-multiple-authentication"
}