Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#15078 closed (invalid)

django.contrib.auth.views.login(...) doesn't accept a form argument

Reported by: hgezim Owned by: nobody
Component: contrib.auth Version: 1.2
Severity: Keywords: login, view
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is my first ticket, so please don't eat me!

I wanted my users to be able to login using their email and password, not the username.

I created a ModelForm that exposed the User's (model) email and password. However, I found out that django.contrib.auth.views.login(...) doesn't accept a form argument.

I think for use cases like this it would be useful to accept a form argument and allow the form to determine what it means to be valid or not.

Change History (2)

comment:1 by Ramiro Morales, 14 years ago

Resolution: invalid
Status: newclosed

Thi is already possible. See http://docs.djangoproject.com/en/1.2/topics/auth/#module-django.contrib.auth.forms (New in Django 1.2: If you are using alternate authentication (see Other authentication sources) you can pass a custom authentication form to the login view via the authentication_form parameter. This form must accept a request keyword argument in its init method, and provide a get_user method which returns the authenticated user object (this method is only ever called after successful form validation).)

comment:2 by Jacob, 13 years ago

Milestone 2.0 deleted

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