summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/signals.txt3
-rw-r--r--docs/topics/auth.txt38
2 files changed, 41 insertions, 0 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index 4c1db33b87..36ad071a75 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -12,6 +12,9 @@ A list of all the signals that Django sends.
The :doc:`comment framework </ref/contrib/comments/index>` sends a :doc:`set
of comment-related signals </ref/contrib/comments/signals>`.
+ The :ref:`authentication framework <topics-auth>` sends :ref:`signals when
+ a user is logged in / out <topics-auth-signals>`.
+
Model signals
=============
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt
index f45c61a94b..748fb89419 100644
--- a/docs/topics/auth.txt
+++ b/docs/topics/auth.txt
@@ -665,6 +665,44 @@ How to log a user out
immediately after logging out, do that *after* calling
:func:`django.contrib.auth.logout()`.
+.. _topics-auth-signals:
+
+Login and logout signals
+------------------------
+
+The auth framework uses two :ref:`signals <topic-signals>` that can be used for
+notification when a user logs in or out.
+
+**:data:`django.contrib.auth.signals.user_logged_in`**
+
+Sent when a user logs in successfully.
+
+Arguments sent with this signal:
+
+ ``sender``
+ As above: the class of the user that just logged in.
+
+ ``request``
+ The current :class:`~django.http.HttpRequest` instance.
+
+ ``user``
+ The user instance that just logged in.
+
+**:data:`django.contrib.auth.signals.user_logged_out`**
+
+Sent when the logout method is called.
+
+ ``sender``
+ As above: the class of the user that just logged out or ``None``
+ if the user was not authenticated.
+
+ ``request``
+ The current :class:`~django.http.HttpRequest` instance.
+
+ ``user``
+ The user instance that just logged out or ``None`` if the
+ user was not authenticated.
+
Limiting access to logged-in users
----------------------------------