Back to index

plone3  3.1.7
require_login.py
Go to the documentation of this file.
00001 ## Script (Python) "require_login"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=
00008 ##title=Login
00009 ##
00010 
00011 login = 'login_form'
00012 
00013 portal = context.portal_url.getPortalObject()
00014 # if cookie crumbler did a traverse instead of a redirect,
00015 # this would be the way to get the value of came_from
00016 #url = portal.getCurrentUrl()
00017 #context.REQUEST.set('came_from', url)
00018 
00019 if context.portal_membership.isAnonymousUser():
00020     return portal.restrictedTraverse(login)()
00021 else:
00022     return portal.restrictedTraverse('insufficient_privileges')()