mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Don't crash when migrating users with blank name
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.
This commit is contained in:
@ -34,6 +34,7 @@ class AuthBackend(ModelBackend):
|
||||
# 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)
|
||||
|
Reference in New Issue
Block a user