summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Willison <simon@simonwillison.net>2007-07-28 18:30:40 +0000
committerSimon Willison <simon@simonwillison.net>2007-07-28 18:30:40 +0000
commitfd2b99b5f122911b895987329507ee419a159a2c (patch)
tree2ca2755d4b824aba4aa45d78b3f82add2fcdb7cd /docs
parent5b898f3f94398aff93b698ecb90213c93269978f (diff)
After discussing with Malcolm, added set_unusable_password() and has_usable_password() methods to the User object, plus tests and updated documentation
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5771 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/authentication.txt19
1 files changed, 16 insertions, 3 deletions
diff --git a/docs/authentication.txt b/docs/authentication.txt
index efe4d47513..637921af84 100644
--- a/docs/authentication.txt
+++ b/docs/authentication.txt
@@ -114,6 +114,17 @@ custom methods:
string is the correct password for the user. (This takes care of the
password hashing in making the comparison.)
+ * ``set_unusable_password()`` -- Marks the user as having no password set.
+ This isn't the same as having a blank string for a password.
+ ``check_password()`` for this user will never return ``True``. Doesn't
+ save the ``User`` object.
+
+ You may need this if authentication for your application takes place
+ against an existing external source such as an LDAP directory.
+
+ * ``has_usable_password()`` -- Returns ``False`` if
+ ``set_unusable_password()`` has been called for this user.
+
* ``get_group_permissions()`` -- Returns a list of permission strings that
the user has, through his/her groups.
@@ -152,9 +163,11 @@ Manager functions
The ``User`` model has a custom manager that has the following helper functions:
- * ``create_user(username, email, password)`` -- Creates, saves and returns
- a ``User``. The ``username``, ``email`` and ``password`` are set as
- given, and the ``User`` gets ``is_active=True``.
+ * ``create_user(username, email, password=None)`` -- Creates, saves and
+ returns a ``User``. The ``username``, ``email`` and ``password`` are set
+ as given, and the ``User`` gets ``is_active=True``.
+
+ If no password is provided, ``set_unusable_password()`` will be called.
See _`Creating users` for example usage.