starting to move authentication to cco.member package; allow special characters in logout's nextUrl

This commit is contained in:
Helmut Merz 2015-11-12 15:45:29 +01:00
parent 9ec755ecd3
commit babb222868
3 changed files with 10 additions and 4 deletions

View file

@ -539,13 +539,13 @@
<!-- query views --> <!-- query views -->
<zope:adapter <!--<zope:adapter
name="login.html" name="login.html"
for="loops.interfaces.IConcept for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest" zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface" provides="zope.interface.Interface"
factory="loops.browser.auth.LoginConcept" factory="loops.browser.auth.LoginConcept"
permission="zope.View" /> permission="zope.View" />-->
<zope:adapter <zope:adapter
name="list_children.html" name="list_children.html"

View file

@ -20,6 +20,7 @@
View class for Node objects. View class for Node objects.
""" """
import urllib
from urlparse import urlparse, urlunparse from urlparse import urlparse, urlunparse
from zope import component, interface, schema from zope import component, interface, schema
from zope.cachedescriptors.property import Lazy from zope.cachedescriptors.property import Lazy
@ -418,6 +419,12 @@ class NodeView(BaseView):
def active(self, item): def active(self, item):
return item.context == self.context or item.context in self.parents return item.context == self.context or item.context in self.parents
@Lazy
def logoutUrl(self):
nextUrl = urllib.urlencode(dict(nextUrl=self.menu.url))
return 'logout.html?' + nextUrl
# virtual target support # virtual target support
@Lazy @Lazy

View file

@ -327,8 +327,7 @@
<metal:actions define-macro="personal"> <metal:actions define-macro="personal">
<div><a href="logout.html?nextURL=login.html" <div><a tal:attributes="href view/logoutUrl"
tal:attributes="href string:logout.html?nextURL=${view/menu/url}"
i18n:translate="">Log out</a></div> i18n:translate="">Log out</a></div>
<tal:actions repeat="action python:view.getAllowedActions('personal')"> <tal:actions repeat="action python:view.getAllowedActions('personal')">
<metal:action use-macro="action/macro" /> <metal:action use-macro="action/macro" />