Show More
@@ -107,17 +107,19 def set_base_path(config): | |||||
107 |
|
107 | |||
108 | def fill_data(user): |
|
108 | def fill_data(user): | |
109 | """ |
|
109 | """ | |
110 | Fills user data with those from database |
|
110 | Fills user data with those from database and log out user if not present | |
|
111 | in database | |||
111 | @param user: |
|
112 | @param user: | |
112 | """ |
|
113 | """ | |
113 | sa = meta.Session |
|
114 | sa = meta.Session | |
114 | dbuser = sa.query(User).get(user.user_id) |
|
115 | dbuser = sa.query(User).get(user.user_id) | |
115 |
|
116 | if dbuser: | ||
116 | user.username = dbuser.username |
|
117 | user.username = dbuser.username | |
117 | user.is_admin = dbuser.admin |
|
118 | user.is_admin = dbuser.admin | |
118 | user.name = dbuser.name |
|
119 | user.name = dbuser.name | |
119 | user.lastname = dbuser.lastname |
|
120 | user.lastname = dbuser.lastname | |
120 |
|
121 | else: | ||
|
122 | user.is_authenticated = False | |||
121 | meta.Session.remove() |
|
123 | meta.Session.remove() | |
122 | return user |
|
124 | return user | |
123 |
|
125 |
General Comments 0
You need to be logged in to leave comments.
Login now