From 051c76e5b865876338be581af90af2b14555d9c6 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 31 Aug 2017 09:25:04 +0200 Subject: [PATCH] Further fixes for Github names with just one name Not only can they be without names, they can be a one word name which would cause a different crash. Again, allow that through and let the user make manual adjustments if they wish. --- pgweb/account/oauthclient.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pgweb/account/oauthclient.py b/pgweb/account/oauthclient.py index 48254c0e..ae17bbdd 100644 --- a/pgweb/account/oauthclient.py +++ b/pgweb/account/oauthclient.py @@ -107,6 +107,10 @@ def oauth_login_github(request): r = oa.get('https://api.github.com/user').json() if 'name' in r: n = r['name'].split(None, 1) + # Some accounts only have one name, extend with an empty + # lastname, so the user can fill it out manually. + while len(n) < 2: + n.append('') else: # Some github accounts have no name on them, so we can just # let the user fill it out manually in that case. -- 2.39.5