Ticket #4819: auth_with_login.diff

File auth_with_login.diff, 1.1 KB (added by David A Krauth, 16 years ago)
  • authentication.txt

     
    315315    else:
    316316        print "Your username and password were incorrect."
    317317
     318
     319Note that a side-effect of a successful call to ``authenticate()`` will result
     320in the ``User`` object being annotated with the appropriate authentication
     321backend (see `Specifying authentication backends`_).
     322
    318323To 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.
     324object and a ``User`` object, where the ``User`` object must already be
     325authenticated. ``login()`` saves the user's ID in the session, using Django's
     326session framework, so, as mentioned above, you'll need to make sure to have the
     327session middleware installed.
    322328
    323329This example shows how you might use both ``authenticate()`` and ``login()``::
    324330
Back to Top