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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
erp5
Commits
3b580cde
Commit
3b580cde
authored
Apr 13, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zope4py3: Update CookieCrumbler monkey-patch to properly handle bytes().
parent
af0cefdc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/Base_getUsernameFromAuthenticationCookie.py
...5_auto_logout/Base_getUsernameFromAuthenticationCookie.py
+2
-3
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
...mplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
+1
-4
product/ERP5Type/Tool/MemcachedTool.py
product/ERP5Type/Tool/MemcachedTool.py
+3
-1
product/ERP5Type/patches/CookieCrumbler.py
product/ERP5Type/patches/CookieCrumbler.py
+11
-2
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/Base_getUsernameFromAuthenticationCookie.py
View file @
3b580cde
from
future
import
standard_library
standard_library
.
install_aliases
()
from
urllib.parse
import
unquote
return
unquote
(
value
).
decode
(
'base64'
).
split
(
':'
,
1
)[
0
]
from
base64
import
standard_b64decode
return
standard_b64decode
(
unquote
(
value
)).
split
(
b':'
,
1
)[
0
].
decode
()
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_auto_logout/setAuthCookie.py
View file @
3b580cde
from
future
import
standard_library
standard_library
.
install_aliases
()
from
past.utils
import
old_div
from
urllib.parse
import
urlparse
portal
=
context
.
getPortalObject
()
...
...
@@ -12,7 +9,7 @@ else:
expire_interval
/=
86400.
# seconds -> days
now
=
DateTime
()
kw
[
'expires'
]
=
(
now
+
expire_interval
).
toZone
(
'GMT'
).
rfc822
()
ac_renew
=
(
now
+
old_div
(
expire_interval
,
2
)
).
millis
()
ac_renew
=
(
now
+
expire_interval
/
2
).
millis
()
portal
.
portal_sessions
[
portal
.
Base_getAutoLogoutSessionKey
(
username
=
portal
.
Base_getUsernameFromAuthenticationCookie
(
...
...
product/ERP5Type/Tool/MemcachedTool.py
View file @
3b580cde
...
...
@@ -59,7 +59,9 @@ def encodeKey(key):
"""
# According to the memcached's protocol.txt, the key cannot contain
# control characters and white spaces.
return
encodestring
(
key
,
True
).
replace
(
'
\
n
'
,
''
).
replace
(
'
\
r
'
,
''
)
if
isinstance
(
key
,
str
):
key
=
key
.
encode
()
return
encodestring
(
key
,
True
).
replace
(
b'
\
n
'
,
b''
).
replace
(
b'
\
r
'
,
b''
)
if
memcache
is
not
None
:
# Real memcache tool
...
...
product/ERP5Type/patches/CookieCrumbler.py
View file @
3b580cde
...
...
@@ -25,6 +25,8 @@ Patch CookieCrumbler to prevent came_from to appear in the URL
when ERP5 runs in "require_referer" mode.
"""
import
six
from
builtins
import
object
from
future
import
standard_library
standard_library
.
install_aliases
()
...
...
@@ -140,7 +142,11 @@ def modifyRequest(self, req, resp):
attempt
=
ATTEMPT_LOGIN
name
=
req
[
self
.
name_cookie
]
pw
=
req
[
self
.
pw_cookie
]
ac
=
standard_b64encode
(
'%s:%s'
%
(
name
,
pw
))
if
six
.
PY2
:
ac
=
standard_b64encode
(
'%s:%s'
%
(
name
,
pw
)).
rstrip
()
else
:
ac
=
standard_b64encode
(
(
'%s:%s'
%
(
name
,
pw
)).
encode
()).
rstrip
().
decode
()
self
.
_setAuthHeader
(
ac
,
req
,
resp
)
if
req
.
get
(
self
.
persist_cookie
,
0
):
# Persist the user name (but not the pw or session)
...
...
@@ -161,7 +167,10 @@ def modifyRequest(self, req, resp):
ac
=
unquote
(
req
[
self
.
auth_cookie
])
if
ac
and
ac
!=
'deleted'
:
try
:
standard_b64decode
(
ac
)
if
six
.
PY2
:
standard_b64decode
(
ac
)
else
:
standard_b64decode
(
ac
.
encode
())
except
:
# Not a valid auth header.
pass
...
...
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