Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 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: UI/UX:

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.

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 3 years ago by jacob

Milestone 2.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.