Ticket #4819: auth_with_login.diff
File auth_with_login.diff, 1.1 KB (added by , 17 years ago) |
---|
-
authentication.txt
315 315 else: 316 316 print "Your username and password were incorrect." 317 317 318 319 Note that a side-effect of a successful call to ``authenticate()`` will result 320 in the ``User`` object being annotated with the appropriate authentication 321 backend (see `Specifying authentication backends`_). 322 318 323 To log a user in, in a view, use ``login()``. It takes an ``HttpRequest`` 319 object and a ``User`` object. ``login()`` saves the user's ID in the session, 320 using Django's session framework, so, as mentioned above, you'll need to make 321 sure to have the session middleware installed. 324 object and a ``User`` object, where the ``User`` object must already be 325 authenticated. ``login()`` saves the user's ID in the session, using Django's 326 session framework, so, as mentioned above, you'll need to make sure to have the 327 session middleware installed. 322 328 323 329 This example shows how you might use both ``authenticate()`` and ``login()``:: 324 330