Allow users to log in using their e-mail address.

Review Request #6103 — Created July 14, 2014 and submitted

Information

Review Board
release-2.0.x
dbbb0d5...

Reviewers

One thing that sometimes happens is that users will try to log in using their
e-mail address instead of their username, and then get confused when it doesn't
work. This is exacerbated by the fact that our sessions last a long time, so
it's often been a very long time since users had to log in.

This change makes it so that if a user logs in, and the username isn't found,
it will try to look up their user by e-mail address.

Logged in to my devserver using both my username and my e-mail address.

Description From Last Updated

Can we combine these into one query? Get an object (or objects) that match at least one of these, and …

chipx86chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/urls.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/urls.py
    
    
  2. 
      
chipx86
  1. I was tempted to do this as well, after the recent attempt.

    What happens if two users have the same e-mail address? We should probably disallow login in that case. Otherwise, the wrong username will be used internally, the password won't match, and the user will be very confused.

  2. reviewboard/accounts/forms/auth.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Can we combine these into one query? Get an object (or objects) that match at least one of these, and figure things out from there?

    1. I don't think it really makes sense to combine them. It would complicate the code quite a bit, and I don't think it's that big a performance problem. These queries operate on separate indices, and this should hopefully be used rarely.

  3. 
      
david
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/urls.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/urls.py
    
    
  2. 
      
chipx86
  1. Ship It!

  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (5bb98da)