Opened 17 years ago

Closed 17 years ago

#4819 closed (fixed)

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

Reported by: django@… Owned by: David A Krauth
Component: Documentation Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (1)

auth_with_login.diff (1.1 KB ) - added by David A Krauth 17 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Gary Wilson <gary.wilson@…>, 17 years ago

Triage Stage: UnreviewedAccepted

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

comment:2 by deepak <deep.thukral@…>, 17 years ago

Component: Contrib appsDocumentation

comment:3 by David A Krauth, 17 years ago

Owner: changed from nobody to David A Krauth
Status: newassigned

by David A Krauth, 17 years ago

Attachment: auth_with_login.diff added

comment:4 by David A Krauth, 17 years ago

Has patch: set

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

comment:5 by David A Krauth, 17 years ago

Triage Stage: AcceptedReady for checkin

Ready for review.

comment:6 by James Bennett, 17 years ago

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.
Back to Top