From bdd5a0de33bbfbb63aaeab7374fc160da7de0c80 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 4 Jul 2018 19:40:34 +0200 Subject: [PATCH] Handle OAuth providers that return NULL for first or last name We already handled those that returns empty, but it appears that at least Microsoft can also return null/None. If those show up, just treat them as empty. --- pgweb/account/oauthclient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgweb/account/oauthclient.py b/pgweb/account/oauthclient.py index 7fcf8c17..67dc4d9a 100644 --- a/pgweb/account/oauthclient.py +++ b/pgweb/account/oauthclient.py @@ -53,8 +53,8 @@ def _login_oauth(request, provider, authurl, tokenurl, scope, authdatafunc): # handled elsewhere, so store the details we got from # the oauth login in the session, and pass the user on. request.session['oauth_email'] = email - request.session['oauth_firstname'] = firstname - request.session['oauth_lastname'] = lastname + request.session['oauth_firstname'] = firstname or '' + request.session['oauth_lastname'] = lastname or '' return HttpResponseRedirect('/account/signup/oauth/') log.info("Oauth signin of {0} using {1} from {2}.".format(email, provider, get_client_ip(request))) -- 2.39.5