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
Labels
Merge Requests
142
Merge Requests
142
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
7e551eb7
Commit
7e551eb7
authored
Apr 13, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: Update CookieCrumbler monkey-patch from upstream to support python3.
parent
fff5683f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
product/ERP5Type/patches/CookieCrumbler.py
product/ERP5Type/patches/CookieCrumbler.py
+11
-2
No files found.
product/ERP5Type/patches/CookieCrumbler.py
View file @
7e551eb7
...
...
@@ -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
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
App.class_init
import
InitializeClass
from
Products.CMFCore.CookieCrumbler
import
CookieCrumbler
...
...
@@ -137,7 +139,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)
...
...
@@ -158,7 +164,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