# HG changeset patch # User Marcin Kuzminski # Date 2010-08-03 19:24:45 # Node ID e0ef325cbdeaeba8758fcacfd348b2f838142089 # Parent 55377fdc1fc630d4211463c2c1842f41ff8217d9 auth functions little fix diff --git a/pylons_app/lib/auth.py b/pylons_app/lib/auth.py --- a/pylons_app/lib/auth.py +++ b/pylons_app/lib/auth.py @@ -107,17 +107,19 @@ def set_base_path(config): def fill_data(user): """ - Fills user data with those from database + Fills user data with those from database and log out user if not present + in database @param user: """ sa = meta.Session dbuser = sa.query(User).get(user.user_id) - - user.username = dbuser.username - user.is_admin = dbuser.admin - user.name = dbuser.name - user.lastname = dbuser.lastname - + if dbuser: + user.username = dbuser.username + user.is_admin = dbuser.admin + user.name = dbuser.name + user.lastname = dbuser.lastname + else: + user.is_authenticated = False meta.Session.remove() return user