Opened 11 years ago

Last modified 2 weeks ago

#20824 assigned New feature

User Auth: A Complete Solution for Email Login Handling

Reported by: JJZolper Owned by: Ülgen Sarıkavak
Component: contrib.auth Version: dev
Severity: Normal Keywords: User Auth Email Login Handling
Cc: timothy.anderegg@…, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

With Django 1.5 more support has been given to those Django developers who wish to have the Email as the username. However, I think we can continue to push onwards to a point where Django can realize a complete solution. By following the user login with username handling but porting it for email handling I think we can solve this issue once and for all. Currently I have been just going online and putting together my own solution, but my hope is with this ticket we can get everyone working together and a finalized solution merged into Django.

Change History (9)

comment:1 by Russell Keith-Magee, 11 years ago

Triage Stage: UnreviewedAccepted

I'm going to accept this as a new feature. I'm almost certain I've heard Jacob advocate for this (can't put my finger on a specific reference for this, though, so I'll stand corrected). Regardless, I think it's the next logical step -- both in terms of making a common use case easy, and providing a clear worked example for "how to do it" if you want to roll your own User model.

In terms of implementation -- this should be provided as a separate contrib app that just contains the email-based user (plus any necssary forms, admin etc), which is in all other respects an exact analog of the default auth.User.

comment:2 by JJZolper, 11 years ago

Owner: changed from nobody to anonymous
Status: newassigned
Version: 1.5master

comment:3 by Russell Keith-Magee, 11 years ago

Whoever takes on this ticket -- keep in mind that there's plenty of existing apps in the wild doing this; we need to take a "best of breed" approach. A couple of options to get started:

comment:4 by Tim Anderegg, 11 years ago

Cc: timothy.anderegg@… added
Has patch: set
Owner: changed from anonymous to Tim Anderegg

Hi All -

I took a crack at creating a patch for this, which can be found here: https://github.com/tanderegg/django/tree/ticket_20824_master

I set it up as a new contrib app called auth_email, which is basically a clone of auth.User and associated forms and admin settings, with the exception of using the email field as username. I also took a look at the two apps that Russel suggested. The first one essentially implements this feature the same way I did. The second takes a similar approach, but includes a rewrite of many of the authentication views using Class Based Views. I thought that was unesseccary for this patch, since I chose not to rewrite any views and instead use those in contrib.auth.

I setup a number of basic tests that cover the new code, but I tried not to include any that covered existing code that was already tested in contrib.auth. There may be a few unnesseccary tests in there, but I don't think I missed any that would be useful.

Please take a look at the code and let me know if there are any glaring problems (this is my first time contributing to django, so be kind :). If nothing comes up in the next day or two, I will submit a pull request.

FYI, this is based on the discussion here: https://groups.google.com/forum/#!topic/django-developers/rb7v9kVAK3I

Thanks!

comment:5 by JJZolper, 11 years ago

I was going to try to move this forward more but I'm glad tanderegg is on it. I see there has been a lot more discussion about this in this thread: https://groups.google.com/forum/#!topic/django-developers/rb7v9kVAK3I. Good to see it's in the works, definitely looking forward to using the ultimate solution. I still think what Russell said here is the best idea, basically just supplementing what exists with an auth contrib app such as auth.EmailUser.

comment:6 by Tomek Paczkowski, 11 years ago

Needs documentation: set
Patch needs improvement: set

I've tried to test out the branch. It applies, but crashes on basic validation, here's error output: http://pastebin.com/P7PwZqBW

comment:7 by Carlton Gibson, 4 years ago

Owner: Tim Anderegg removed
Status: assignednew

comment:8 by Ülgen Sarıkavak, 9 months ago

Cc: Ülgen Sarıkavak added

comment:9 by Ülgen Sarıkavak, 2 weeks ago

Owner: set to Ülgen Sarıkavak
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top