Django

Code

Ticket #4819 (closed: fixed)

Opened 1 year ago

Last modified 9 months ago

django.contrib.auth.login doesn't just take any user, it needs one that's been modified by authenticate

Reported by: django@catchall.getdown.org Assigned to: dakrauth
Milestone: Component: Documentation
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Looking at http://www.djangoproject.com/documentation/authentication/, you'd think you could just pass in a request and a User. But you can't. The code for login needs the side effect caused by calling authenticate, which is to add the backend to the user object.

This is very frustrating when writing code where you'd like to log a user in automatically. At the very least, the documentation needs to be changed to reflect it.

Attachments

auth_with_login.diff (1.1 kB) - added by dakrauth on 12/01/07 11:50:16.

Change History

07/09/07 23:31:01 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

Yes, this looks like it should be mentioned somewhere in the authentication docs and probably in login()'s docstring also.

09/15/07 02:26:05 changed by deepak <deep.thukral@gmail.com>

  • component changed from Contrib apps to Documentation.

12/01/07 10:39:08 changed by dakrauth

  • owner changed from nobody to dakrauth.
  • status changed from new to assigned.

12/01/07 11:50:16 changed by dakrauth

  • attachment auth_with_login.diff added.

12/01/07 11:51:51 changed by dakrauth

  • has_patch set to 1.

Mentioned the need for login() to take a pre-authenticated User object.

12/01/07 12:01:02 changed by dakrauth

  • stage changed from Accepted to Ready for checkin.

Ready for review.

12/01/07 13:52:53 changed by ubernostrum

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [6805]) Fixed #4819: documented the need to call authenticate() before login(), based on a patch from Davd Krauth.


Add/Change #4819 (django.contrib.auth.login doesn't just take any user, it needs one that's been modified by authenticate)




Change Properties
Action