Skip to content
Browse files

After-login redirects

  • Loading branch information...
1 parent dac9dd2 commit b3cc2a022c6053c45a4a82be287e181bf8dc8556 @brendonh committed Jun 2, 2011
Showing with 17 additions and 2 deletions.
  1. +1 −0 warp/common/avatar.py
  2. +1 −0 warp/templates/accessdenied.mak
  3. +9 −1 warp/webserver/auth.py
  4. +6 −1 warp/webserver/resource.py
View
1 warp/common/avatar.py
@@ -44,6 +44,7 @@ class DBSession(Storm):
language = u"en_US"
messages = None
+ afterLogin = None
def __storm_loaded__(self):
if self.language is None:
View
1 warp/templates/accessdenied.mak
@@ -0,0 +1 @@
+ACCESS DENIED
View
10 warp/webserver/auth.py
@@ -13,7 +13,15 @@ class LoginBase(object):
def render(self, request):
self.doIt(request)
- url = "/%s" % "/".join(request.postpath)
+
+ if request.session.avatar is not None and request.session.afterLogin is not None:
+ url = request.session.afterLogin
+ request.session.afterLogin = None
+ else:
+ url = "/%s" % "/".join(request.postpath)
+
+ print repr(request.session.afterLogin)
+
request.redirect(url)
return "Redirecting..."
View
7 warp/webserver/resource.py
@@ -135,9 +135,14 @@ class AccessDenied(object):
implements(IResource)
isLeaf = True
+ facetName = "view"
+ args = ()
def render(self, request):
- return "ACCESS DENIED"
+ request.node = None
+ request.resource = self
+ template = templateLookup.get_template("/accessdenied.mak")
+ return helpers.renderTemplateObj(request, template)

0 comments on commit b3cc2a0

Please sign in to comment.
Something went wrong with that request. Please try again.