-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redirect to cas login in case of a require_login
- Loading branch information
Adria DEV
committed
Aug 12, 2013
1 parent
f459b42
commit 709288b
Showing
5 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<object name="portal_skins" default_skin=""> | ||
|
||
<object name="collective_castle_login" meta_type="Filesystem Directory View" | ||
directory="collective.castle:skins/collective_castle_login"/> | ||
|
||
<skin-path name="*"> | ||
<layer name="collective_castle_login" insert-after="custom"/> | ||
</skin-path> | ||
|
||
</object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/collective/castle/skins/collective_castle_login/require_login.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Script (Python) "require_login" | ||
##bind container=container | ||
##bind context=context | ||
##bind namespace= | ||
##bind script=script | ||
##bind subpath=traverse_subpath | ||
##parameters= | ||
##title=Login | ||
|
||
login = 'login' | ||
|
||
portal = context.portal_url.getPortalObject() | ||
# if cookie crumbler did a traverse instead of a redirect, | ||
# this would be the way to get the value of came_from | ||
#url = portal.getCurrentUrl() | ||
#context.REQUEST.set('came_from', url) | ||
|
||
if context.portal_membership.isAnonymousUser(): | ||
url = context.restrictedTraverse('@@castle_login_url')() | ||
context.REQUEST.response.redirect(url) | ||
return | ||
else: | ||
return portal.restrictedTraverse('insufficient_privileges')() |