diff pylons_app/lib/auth.py @ 437:930f8182a884

Added redirection to page that request came from, after login in
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 29 Aug 2010 00:11:28 +0200
parents 55ada111bca6
children d66a7fa7689b
line wrap: on
line diff
--- a/pylons_app/lib/auth.py	Sat Aug 28 14:53:32 2010 +0200
+++ b/pylons_app/lib/auth.py	Sun Aug 29 00:11:28 2010 +0200
@@ -228,8 +228,12 @@
             return func(*fargs, **fkwargs)
         else:
             log.warn('user %s not authenticated', user.username)
-            log.debug('redirecting to login page')
-            return redirect(url('login_home'))
+
+            p = request.environ.get('PATH_INFO')
+            if request.environ.get('QUERY_STRING'):
+                p+='?'+request.environ.get('QUERY_STRING')
+            log.debug('redirecting to login page with %',p)                
+            return redirect(url('login_home',came_from=p))
 
 class PermsDecorator(object):
     """Base class for decorators"""