mirror of https://github.com/django/django.git
Normalized indentation and line lengths in docs/topics/auth/default.txt.
This commit is contained in:
parent
c082363527
commit
5fd83db255
|
@ -1024,16 +1024,16 @@ implementation details see :ref:`using-the-views`.
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
If you have customized authentication (see
|
If you have customized authentication (see
|
||||||
:doc:`Customizing Authentication </topics/auth/customizing>`) you can pass a custom authentication form
|
:doc:`Customizing Authentication </topics/auth/customizing>`) you can pass
|
||||||
to the login view via the ``authentication_form`` parameter. This form must
|
a custom authentication form to the login view via the
|
||||||
accept a ``request`` keyword argument in its ``__init__`` method, and
|
``authentication_form`` parameter. This form must accept a ``request``
|
||||||
provide a ``get_user`` method which returns the authenticated user object
|
keyword argument in its ``__init__`` method, and provide a ``get_user()``
|
||||||
(this method is only ever called after successful form validation).
|
method which returns the authenticated user object (this method is only
|
||||||
|
ever called after successful form validation).
|
||||||
|
|
||||||
.. _forms documentation: ../forms/
|
.. _forms documentation: ../forms/
|
||||||
.. _site framework docs: ../sites/
|
.. _site framework docs: ../sites/
|
||||||
|
|
||||||
|
|
||||||
.. function:: logout(request, [next_page, template_name, redirect_field_name, current_app, extra_context])
|
.. function:: logout(request, [next_page, template_name, redirect_field_name, current_app, extra_context])
|
||||||
|
|
||||||
Logs a user out.
|
Logs a user out.
|
||||||
|
@ -1163,7 +1163,6 @@ implementation details see :ref:`using-the-views`.
|
||||||
:class:`~django.contrib.auth.forms.PasswordResetForm` and use the
|
:class:`~django.contrib.auth.forms.PasswordResetForm` and use the
|
||||||
``password_reset_form`` argument.
|
``password_reset_form`` argument.
|
||||||
|
|
||||||
|
|
||||||
Users flagged with an unusable password (see
|
Users flagged with an unusable password (see
|
||||||
:meth:`~django.contrib.auth.models.User.set_unusable_password()` aren't
|
:meth:`~django.contrib.auth.models.User.set_unusable_password()` aren't
|
||||||
allowed to request a password reset to prevent misuse when using an
|
allowed to request a password reset to prevent misuse when using an
|
||||||
|
@ -1265,8 +1264,9 @@ implementation details see :ref:`using-the-views`.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If the email address provided does not exist in the system, the user is inactive, or has an unusable password,
|
If the email address provided does not exist in the system, the user is
|
||||||
the user will still be redirected to this view but no email will be sent.
|
inactive, or has an unusable password, the user will still be
|
||||||
|
redirected to this view but no email will be sent.
|
||||||
|
|
||||||
**Optional arguments:**
|
**Optional arguments:**
|
||||||
|
|
||||||
|
@ -1324,22 +1324,22 @@ implementation details see :ref:`using-the-views`.
|
||||||
|
|
||||||
.. function:: password_reset_complete(request[,template_name, current_app, extra_context])
|
.. function:: password_reset_complete(request[,template_name, current_app, extra_context])
|
||||||
|
|
||||||
Presents a view which informs the user that the password has been
|
Presents a view which informs the user that the password has been
|
||||||
successfully changed.
|
successfully changed.
|
||||||
|
|
||||||
**URL name:** ``password_reset_complete``
|
**URL name:** ``password_reset_complete``
|
||||||
|
|
||||||
**Optional arguments:**
|
**Optional arguments:**
|
||||||
|
|
||||||
* ``template_name``: The full name of a template to display the view.
|
* ``template_name``: The full name of a template to display the view.
|
||||||
Defaults to :file:`registration/password_reset_complete.html`.
|
Defaults to :file:`registration/password_reset_complete.html`.
|
||||||
|
|
||||||
* ``current_app``: A hint indicating which application contains the current
|
* ``current_app``: A hint indicating which application contains the current
|
||||||
view. See the :ref:`namespaced URL resolution strategy
|
view. See the :ref:`namespaced URL resolution strategy
|
||||||
<topics-http-reversing-url-namespaces>` for more information.
|
<topics-http-reversing-url-namespaces>` for more information.
|
||||||
|
|
||||||
* ``extra_context``: A dictionary of context data that will be added to the
|
* ``extra_context``: A dictionary of context data that will be added to the
|
||||||
default context data passed to the template.
|
default context data passed to the template.
|
||||||
|
|
||||||
Helper functions
|
Helper functions
|
||||||
----------------
|
----------------
|
||||||
|
@ -1364,7 +1364,6 @@ Helper functions
|
||||||
URL to redirect to after log out. Overrides ``next`` if the given
|
URL to redirect to after log out. Overrides ``next`` if the given
|
||||||
``GET`` parameter is passed.
|
``GET`` parameter is passed.
|
||||||
|
|
||||||
|
|
||||||
.. _built-in-auth-forms:
|
.. _built-in-auth-forms:
|
||||||
|
|
||||||
Built-in forms
|
Built-in forms
|
||||||
|
@ -1399,14 +1398,16 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
|
||||||
|
|
||||||
.. method:: confirm_login_allowed(user)
|
.. method:: confirm_login_allowed(user)
|
||||||
|
|
||||||
By default, ``AuthenticationForm`` rejects users whose ``is_active`` flag
|
By default, ``AuthenticationForm`` rejects users whose ``is_active``
|
||||||
is set to ``False``. You may override this behavior with a custom policy to
|
flag is set to ``False``. You may override this behavior with a custom
|
||||||
determine which users can log in. Do this with a custom form that subclasses
|
policy to determine which users can log in. Do this with a custom form
|
||||||
``AuthenticationForm`` and overrides the ``confirm_login_allowed`` method.
|
that subclasses ``AuthenticationForm`` and overrides the
|
||||||
This method should raise a :exc:`~django.core.exceptions.ValidationError`
|
``confirm_login_allowed()`` method. This method should raise a
|
||||||
if the given user may not log in.
|
:exc:`~django.core.exceptions.ValidationError` if the given user may
|
||||||
|
not log in.
|
||||||
|
|
||||||
For example, to allow all users to log in, regardless of "active" status::
|
For example, to allow all users to log in regardless of "active"
|
||||||
|
status::
|
||||||
|
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
|
|
||||||
|
@ -1447,8 +1448,9 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
|
||||||
|
|
||||||
:param subject_template_name: the template for the subject.
|
:param subject_template_name: the template for the subject.
|
||||||
:param email_template_name: the template for the email body.
|
:param email_template_name: the template for the email body.
|
||||||
:param context: context passed to the ``subject_template``, ``email_template``,
|
:param context: context passed to the ``subject_template``,
|
||||||
and ``html_email_template`` (if it is not ``None``).
|
``email_template``, and ``html_email_template`` (if it is not
|
||||||
|
``None``).
|
||||||
:param from_email: the sender's email.
|
:param from_email: the sender's email.
|
||||||
:param to_email: the email of the requester.
|
:param to_email: the email of the requester.
|
||||||
:param html_email_template_name: the template for the HTML body;
|
:param html_email_template_name: the template for the HTML body;
|
||||||
|
@ -1474,7 +1476,6 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
|
||||||
|
|
||||||
.. currentmodule:: django.contrib.auth
|
.. currentmodule:: django.contrib.auth
|
||||||
|
|
||||||
|
|
||||||
Authentication data in templates
|
Authentication data in templates
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
@ -1484,11 +1485,11 @@ The currently logged-in user and their permissions are made available in the
|
||||||
|
|
||||||
.. admonition:: Technicality
|
.. admonition:: Technicality
|
||||||
|
|
||||||
Technically, these variables are only made available in the template
|
Technically, these variables are only made available in the template
|
||||||
context if you use :class:`~django.template.RequestContext` and the
|
context if you use :class:`~django.template.RequestContext` and the
|
||||||
``'django.contrib.auth.context_processors.auth'`` context processor is
|
``'django.contrib.auth.context_processors.auth'`` context processor is
|
||||||
enabled. It is in the default generated settings file. For more, see the
|
enabled. It is in the default generated settings file. For more, see the
|
||||||
:ref:`RequestContext docs <subclassing-context-requestcontext>`.
|
:ref:`RequestContext docs <subclassing-context-requestcontext>`.
|
||||||
|
|
||||||
Users
|
Users
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
Loading…
Reference in New Issue