Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
ef35e421
Commit
ef35e421
authored
Nov 08, 2016
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: ERP5 Auto Logout use PAS to set and revoke credential
parent
5eb36066
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
26 deletions
+8
-26
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/logout.py
.../SkinTemplateItem/portal_skins/erp5_auto_logout/logout.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
...mplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
+6
-24
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.xml
...plateItem/portal_skins/erp5_auto_logout/setAuthCookie.xml
+1
-1
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/logout.py
View file @
ef35e421
...
...
@@ -8,5 +8,5 @@ portal.portal_sessions.manage_delObjects(
REQUEST
=
portal
.
REQUEST
if
REQUEST
.
has_key
(
'portal_skin'
):
portal
.
portal_skins
.
clearSkinCookie
()
REQUEST
.
RESPONSE
.
expireCookie
(
'__ac'
,
path
=
'/'
)
portal
.
acl_users
.
logout
(
REQUEST
)
return
REQUEST
.
RESPONSE
.
redirect
(
REQUEST
.
URL1
+
'/logged_out'
)
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
View file @
ef35e421
from
base64
import
standard_b64encode
,
standard_b64decode
if
cookie_value
is
not
None
and
login
is
None
:
from
urllib
import
unquote
login
,
password
=
unquote
(
cookie_value
).
decode
(
'base64'
).
split
(
':'
,
1
)
portal
=
context
.
getPortalObject
()
kw
=
{}
expire_interval
=
portal
.
portal_preferences
.
getPreferredMaxUserInactivityDuration
()
if
expire_interval
in
(
''
,
None
):
ac_renew
=
float
(
'inf'
)
else
:
expire_interval
/=
86400.
# seconds -> days
now
=
DateTime
()
kw
[
'expires'
]
=
(
now
+
expire_interval
).
toZone
(
'GMT'
).
rfc822
()
ac_renew
=
(
now
+
expire_interval
/
2
).
millis
()
portal
.
portal_sessions
[
portal
.
Base_getAutoLogoutSessionKey
(
username
=
portal
.
Base_getUsernameFromAuthenticationCookie
(
cookie_value
,
)
)
][
'ac_renew'
]
=
ac_renew
resp
.
setCookie
(
name
=
cookie_name
,
value
=
cookie_value
,
path
=
'/'
,
secure
=
getattr
(
portal
,
'REQUEST'
,
{}).
get
(
'SERVER_URL'
,
''
).
startswith
(
'https:'
),
http_only
=
True
,
**
kw
)
portal
.
acl_users
.
updateCredentials
(
context
.
REQUEST
,
resp
,
login
,
password
)
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.xml
View file @
ef35e421
...
...
@@ -170,7 +170,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
resp, cookie_name, cookie_value
</string>
</value>
<value>
<string>
resp, cookie_name, cookie_value
=None, login=None, password=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment