summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-11-09 10:56:18 +0100
committerAleš Smodiš <aless@guru.si>2015-11-09 10:56:18 +0100
commit81a761ae7e8bb95567c9ad47a20bfcf1b3073593 (patch)
treed55752fe7eecee9300f914f204ccf2dcb4564b9a /server
parentbfe3be04dde8b72bba1d0dd30ce48625b48cffa4 (diff)
Bugfix: SAML login method did not return correct field for the e-mail.
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)