Skip to content

Commit

Permalink
Don't crash when migrating users with blank name
Browse files Browse the repository at this point in the history
Some users are registered with just a username and no actual name. The
old way only dealt with users with just first or last name - not the
ones completely without name.
  • Loading branch information
mhagander committed Dec 8, 2011
1 parent 38bad00 commit 580c85b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pgweb/util/auth.py
Expand Up @@ -34,6 +34,7 @@ def authenticate(self, username=None, password=None):
# create a user in the django system, and migrate all settings
# we can think of.
namepieces = rows[0][2].split(None, 2)
if len(namepieces) == 0: namepieces = ['', '']
if len(namepieces) == 1: namepieces.append('')
user = User(username=username.lower(), email=rows[0][3], first_name=namepieces[0], last_name=namepieces[1])
user.set_password(password)
Expand Down

0 comments on commit 580c85b

Please sign in to comment.