#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.
Note:
See TracTickets
for help on using tickets.
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).)