summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/user_session.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/user_session.py b/server/user_session.py
index 79dc93d..19c29c6 100644
--- a/server/user_session.py
+++ b/server/user_session.py
@@ -146,13 +146,15 @@ class UserSession(object):
try:
cur = conn.cursor()
try:
- cur.execute('update codeq_user set name = coalesce(%s, name), email = coalesce(%s, email), saml_data = %s, last_login = %s where username = %s and password is null returning id, gui_lang, date_joined, robot_address, gui_layout', (name, email, psycopg2.extras.Json(saml_data), str(now), eduPersonPrincipalName))
+ cur.execute('update codeq_user set name = coalesce(%s, name), email = coalesce(%s, email), saml_data = %s, last_login = %s where username = %s and password is null returning id, gui_lang, date_joined, robot_address, gui_layout, email', (name, email, psycopg2.extras.Json(saml_data), str(now), eduPersonPrincipalName))
row = cur.fetchone()
if row:
self.uid = row[0]
self.username = eduPersonPrincipalName
self.settings = {'gui_lang': row[1], 'robot_address': row[3], 'gui_layout': row[4]}
date_joined = row[2]
+ if email is None:
+ email = row[5]
else:
# the account does not exist yet, either create one or upgrade an existing one
while True: # a trick loop, so we are able to exit the code block where ever we want
@@ -189,7 +191,7 @@ class UserSession(object):
finally:
cur.close()
conn.commit()
- return name, eduPersonPrincipalName, date_joined, now
+ return name, email, date_joined, now
finally:
db.return_connection(conn)