Commit bfffc315ee81a8c65edef744219958349dea3c6e
1 parent
20820f69
Exists in
master
and in
39 other branches
Creating session attribute if it doesn't exists - updates #104
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
src/proxy/models.py
... | ... | @@ -162,3 +162,16 @@ def change_session_attribute_email(sender, instance, **kwargs): |
162 | 162 | cursor.execute(("UPDATE session_attribute SET value=%s " |
163 | 163 | "WHERE name='name' AND sid=%s"), |
164 | 164 | [instance.get_full_name(), instance.username]) |
165 | + | |
166 | + cursor.execute(("INSERT INTO session_attribute " | |
167 | + "(sid, authenticated, name, value) " | |
168 | + "SELECT %s, '1', 'email', %s WHERE NOT EXISTS " | |
169 | + "(SELECT 1 FROM session_attribute WHERE sid=%s)"), | |
170 | + [instance.username, instance.email, instance.username]) | |
171 | + | |
172 | + cursor.execute(("INSERT INTO session_attribute " | |
173 | + "(sid, authenticated, name, value) " | |
174 | + "SELECT %s, '1', 'name', %s WHERE NOT EXISTS " | |
175 | + "(SELECT 1 FROM session_attribute WHERE sid=%s)"), | |
176 | + [instance.username, instance.get_full_name(), | |
177 | + instance.username]) | ... | ... |