Commit ba85794f authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

patches/CookieCrumbler: update patch for CMF 2.3

ICookieCrumbler.credentialsChanged signature changed in Products.CMFCore
2.3.0-beta. We also update the patch on the same occasion.
parent 09c09320
...@@ -176,12 +176,21 @@ def modifyRequest(self, req, resp): ...@@ -176,12 +176,21 @@ def modifyRequest(self, req, resp):
CookieCrumbler.modifyRequest = modifyRequest CookieCrumbler.modifyRequest = modifyRequest
def credentialsChanged(self, user, name, pw): def credentialsChanged(self, user, name, pw, request=None):
ac = standard_b64encode('%s:%s' % (name, pw)) """
method = self.getCookieMethod( 'setAuthCookie' Updates cookie credentials if user details are changed.
, self.defaultSetAuthCookie ) """
resp = self.REQUEST['RESPONSE'] if request is None:
method( resp, self.auth_cookie, quote( ac ) ) request = getRequest() # BBB for Membershiptool
reponse = request['RESPONSE']
# <patch>
# We don't want new lines, so use base64.standard_b64encode instead of
# base64.encodestring
ac = standard_b64encode('%s:%s' % (name, pw)).rstrip()
# </patch>
method = self.getCookieMethod('setAuthCookie',
self.defaultSetAuthCookie)
method(reponse, self.auth_cookie, quote(ac))
CookieCrumbler.credentialsChanged = credentialsChanged CookieCrumbler.credentialsChanged = credentialsChanged
......
...@@ -20,8 +20,7 @@ from OFS.DTMLMethod import DTMLMethod ...@@ -20,8 +20,7 @@ from OFS.DTMLMethod import DTMLMethod
from OFS.Folder import Folder from OFS.Folder import Folder
from AccessControl.User import UserFolder from AccessControl.User import UserFolder
from Products.CMFCore.CookieCrumbler \ from Products.CMFCore.CookieCrumbler import CookieCrumbler, manage_addCC
import CookieCrumbler, manage_addCC, Redirect
from Products.CMFCore.tests.test_CookieCrumbler import makerequest from Products.CMFCore.tests.test_CookieCrumbler import makerequest
from Products.CMFCore.tests.test_CookieCrumbler import CookieCrumblerTests from Products.CMFCore.tests.test_CookieCrumbler import CookieCrumblerTests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment