diff options
author | Robert Zorko <robertz@gurucue.com> | 2015-10-16 15:20:25 +0200 |
---|---|---|
committer | Robert Zorko <robertz@gurucue.com> | 2015-10-16 15:20:25 +0200 |
commit | 38edde81a6c3a3d97737db01aaaab2fbc800d940 (patch) | |
tree | 7ed0112d99d70857f6ba76936ce77bf38739900c /server | |
parent | 4a781b21db10f82e35b9945109b5f4d41ad0e8c3 (diff) |
added gui_layout to the settings of the user
Diffstat (limited to 'server')
-rw-r--r-- | server/user_session.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/user_session.py b/server/user_session.py index dbf886c..976f144 100644 --- a/server/user_session.py +++ b/server/user_session.py @@ -71,7 +71,7 @@ class UserSession(object): try: cur = conn.cursor() try: - cur.execute('select id, password, name, email, date_joined, gui_lang, robot_address from codeq_user where username = %s', (username,)) + cur.execute('select id, password, name, email, date_joined, gui_lang, robot_address, gui_layout from codeq_user where username = %s', (username,)) row = cur.fetchone() if row is None: raise AuthenticationFailed('No such user: {}'.format(username)) @@ -79,7 +79,7 @@ class UserSession(object): cur.execute('update codeq_user set last_login = %s where id = %s', (str(now), row[0],)) self.uid = row[0] self.username = username - self.settings = {'gui_lang': row[5], 'robot_address': row[6]} + self.settings = {'gui_lang': row[5], 'robot_address': row[6], 'gui_layout': row[7]} return row[2], row[3], row[4], now else: raise AuthenticationFailed('Password mismatch') @@ -129,12 +129,12 @@ class UserSession(object): try: cur = conn.cursor() try: - cur.execute('update codeq_user set name = %s, email = %s, saml_data = %s, last_login = %s where username = %s and saml_data is not null returning id, gui_lang, date_joined, robot_address', (name, email, psycopg2.extras.Json(saml_data), str(now), uuid)) + cur.execute('update codeq_user set name = %s, email = %s, saml_data = %s, last_login = %s where username = %s and saml_data is not null returning id, gui_lang, date_joined, robot_address, gui_layout', (name, email, psycopg2.extras.Json(saml_data), str(now), uuid)) row = cur.fetchone() if row: self.uid = row[0] self.username = uuid - self.settings = {'gui_lang': row[1], 'robot_address': row[3]} + self.settings = {'gui_lang': row[1], 'robot_address': row[3], 'gui_layout': row[4]} return name, email, row[2], now else: cur.execute('insert into codeq_user (username, name, email, is_admin, is_active, date_joined, last_login, gui_lang, saml_data) values (%s, %s, %s, %s, %s, %s, %s, %s, %s) returning id', (uuid, name, email, False, True, str(now), str(now), gui_lang, psycopg2.extras.Json(saml_data))) @@ -143,7 +143,7 @@ class UserSession(object): raise SignupFailed('Sign-up failed') self.uid = row[0] self.username = uuid - self.settings = {'gui_lang': gui_lang, 'robot_address': None} + self.settings = {'gui_lang': gui_lang, 'robot_address': None, 'gui_layout': None} return name, email, now, now finally: cur.close() @@ -202,7 +202,7 @@ class UserSession(object): try: cur = conn.cursor() try: - cur.execute("update codeq_user set gui_lang = %s, robot_address = %s where id = %s", (self.settings['gui_lang'], self.settings['robot_address'], self.uid)) + cur.execute("update codeq_user set gui_lang = %s, robot_address = %s, gui_layout = %s where id = %s", (self.settings['gui_lang'], self.settings['robot_address'], self.settings['gui_layout'],self.uid)) finally: cur.close() conn.commit() |