Commit 60e23eb7 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 70325775
......@@ -176,12 +176,21 @@ def modifyRequest(self, req, resp):
CookieCrumbler.modifyRequest = modifyRequest
def credentialsChanged(self, user, name, pw):
ac = standard_b64encode('%s:%s' % (name, pw))
method = self.getCookieMethod( 'setAuthCookie'
, self.defaultSetAuthCookie )
resp = self.REQUEST['RESPONSE']
method( resp, self.auth_cookie, quote( ac ) )
def credentialsChanged(self, user, name, pw, request=None):
"""
Updates cookie credentials if user details are changed.
"""
if request is None:
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
......
......@@ -20,8 +20,7 @@ from OFS.DTMLMethod import DTMLMethod
from OFS.Folder import Folder
from AccessControl.User import UserFolder
from Products.CMFCore.CookieCrumbler \
import CookieCrumbler, manage_addCC, Redirect
from Products.CMFCore.CookieCrumbler import CookieCrumbler, manage_addCC
from Products.CMFCore.tests.test_CookieCrumbler import makerequest
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