Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#10763 closed (duplicate)

Allow custom AuthenticationForm in django.contrib.auth login view.

Reported by: chronos Owned by: nobody
Component: contrib.auth Version: 1.1-beta
Severity: Keywords: login, forms, authentication, customization, custom
Cc: bas@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The idea is: allow develop to set a custom authentication form in login view without change much code.

Support of custom forms is usefull if developer use a custom form class, if plan to make more things in authentication that default form does (if for some motive he not want to write your own view) and, after all, form is better place to validate trought e-mail instead username (a common request I think).

This patch allow develop to send own authentication form to login view in urls.py and do what he wants in form.
I attach patch, a urls.py snippet and a form that I used to show example. My form use <a href="https://launchpad.net/django-form-utils">django-form-utils</a> in case to allow more customizable forms.

Attachments (3)

login_custom_form.diff (1.3 KB) - added by chronos 6 years ago.
The patch in views.py
login_custom_form-urls.py (228 bytes) - added by chronos 6 years ago.
The urls.py example.
login_custom_form-forms.py (1.7 KB) - added by chronos 6 years ago.
The form in forms.py that I using, basically a copy of AuthenticationForm

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by chronos

The patch in views.py

Changed 6 years ago by chronos

The urls.py example.

Changed 6 years ago by chronos

The form in forms.py that I using, basically a copy of AuthenticationForm

comment:1 Changed 6 years ago by Alex

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

Dupe #8274.

comment:2 Changed 5 years ago by parxier

  • Cc bas@… added

comment:3 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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