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
15a42a59
Commit
15a42a59
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
22af8200
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 @
15a42a59
...
@@ -25,6 +25,8 @@ Patch CookieCrumbler to prevent came_from to appear in the URL
...
@@ -25,6 +25,8 @@ Patch CookieCrumbler to prevent came_from to appear in the URL
when ERP5 runs in "require_referer" mode.
when ERP5 runs in "require_referer" mode.
"""
"""
import
six
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
App.class_init
import
InitializeClass
from
App.class_init
import
InitializeClass
from
Products.CMFCore.CookieCrumbler
import
CookieCrumbler
from
Products.CMFCore.CookieCrumbler
import
CookieCrumbler
...
@@ -137,7 +139,11 @@ def modifyRequest(self, req, resp):
...
@@ -137,7 +139,11 @@ def modifyRequest(self, req, resp):
attempt
=
ATTEMPT_LOGIN
attempt
=
ATTEMPT_LOGIN
name
=
req
[
self
.
name_cookie
]
name
=
req
[
self
.
name_cookie
]
pw
=
req
[
self
.
pw_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
)
self
.
_setAuthHeader
(
ac
,
req
,
resp
)
if
req
.
get
(
self
.
persist_cookie
,
0
):
if
req
.
get
(
self
.
persist_cookie
,
0
):
# Persist the user name (but not the pw or session)
# Persist the user name (but not the pw or session)
...
@@ -158,7 +164,10 @@ def modifyRequest(self, req, resp):
...
@@ -158,7 +164,10 @@ def modifyRequest(self, req, resp):
ac
=
unquote
(
req
[
self
.
auth_cookie
])
ac
=
unquote
(
req
[
self
.
auth_cookie
])
if
ac
and
ac
!=
'deleted'
:
if
ac
and
ac
!=
'deleted'
:
try
:
try
:
standard_b64decode
(
ac
)
if
six
.
PY2
:
standard_b64decode
(
ac
)
else
:
standard_b64decode
(
ac
.
encode
())
except
:
except
:
# Not a valid auth header.
# Not a valid auth header.
pass
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