Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Run this command to install ``django-mail-auth``::
Setup
-----

First add ``mailauth`` to you installed apps::
First add ``mailauth`` to you installed apps:

.. code-block:: python

INSTALLED_APPS = [
# Django's builtin apps…
Expand All @@ -64,7 +66,9 @@ First add ``mailauth`` to you installed apps::
with token based authentication too.

``mailauth.contrib.user`` is optional and provides a new Django User model.
The new User model needs to be enabled via the ``AUTH_USER_MODEL`` setting::
The new User model needs to be enabled via the ``AUTH_USER_MODEL`` setting:

.. code-block:: python

# This setting should be either "EmailUser" or
# any custom subclass of "AbstractEmailUser"
Expand All @@ -74,7 +78,9 @@ The new User model needs to be enabled via the ``AUTH_USER_MODEL`` setting::
WAGTAILUSERS_PASSWORD_ENABLED = False


Next you will need to add the new authentication backend::
Next you will need to add the new authentication backend:

.. code-block:: python

AUTHENTICATION_BACKENDS = (
# default, but now optional
Expand All @@ -89,7 +95,9 @@ Next you will need to add the new authentication backend::
Django's ``ModelBackend`` is only needed, if you still want to support
password based authentication. If you don't, simply remove it from the list.

Last but not least, go to your URL root configuration ``urls.py`` and add the following::
Last but not least, go to your URL root configuration ``urls.py`` and add the following:

.. code-block:: python

from django.urls import path

Expand All @@ -107,12 +115,12 @@ That's it!

.. |version| image:: https://img.shields.io/pypi/v/django-mail-auth.svg
:target: https://pypi.python.org/pypi/django-mail-auth/
.. |ci| image:: https://travis-ci.com/codingjoe/django-mail-auth.svg?branch=master
.. |ci| image:: https://travis-ci.com/codingjoe/django-mail-auth.svg?branch=main
:target: https://travis-ci.com/codingjoe/django-mail-auth
.. |coverage| image:: https://codecov.io/gh/codingjoe/django-mail-auth/branch/master/graph/badge.svg
.. |coverage| image:: https://codecov.io/gh/codingjoe/django-mail-auth/branch/main/graph/badge.svg
:target: https://codecov.io/gh/codingjoe/django-mail-auth
.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: :target: https://raw.githubusercontent.com/codingjoe/django-mail-auth/master/LICENSE
:target: :target: https://raw.githubusercontent.com/codingjoe/django-mail-auth/main/LICENSE
.. |docs| image:: https://readthedocs.org/projects/django-mail-auth/badge/?version=latest
:target: https://django-mail-auth.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
8 changes: 6 additions & 2 deletions docs/customizing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Custom login forms need to inherit from :class:`.BaseLoginForm` and override
the :meth:`save<.BaseLoginForm.save>` method.

The following example is for a login SMS. This will require a
custom user model with a unique ``phone_number`` field::
custom user model with a unique ``phone_number`` field:

.. code-block:: python

from django import forms
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -59,7 +61,9 @@ custom user model with a unique ``phone_number`` field::


To add the new login form, simply add a new login view to your URL configuration with
the custom form::
the custom form:

.. code-block:: python

from django.urls import path
from mailauth.views import LoginView
Expand Down