Commit ec08314c authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_advanced_ecommerce: use setAuthCookie

parent 15069e70
from base64 import standard_b64encode
from urllib import quote
portal = context.getPortalObject()
translateString = context.Base_translateString
website = context.getWebSiteValue()
......@@ -28,15 +31,8 @@ if person_list:
return getattr(website, form_id)()
# create Person account
person_module = portal.getDefaultModule(portal_type='Person')
person = person_module.newContent(portal_type='Person')
person = portal.person_module.newContent(portal_type='Person')
user_id = person.Person_getUserId()
# Create default career
person.newContent(portal_type='Career',
id='default_career',
group=person_group,
function=person_function,
role=person_role)
# Create assignment
assignment = person.newContent(portal_type='Assignment',
group=person_group,
......@@ -73,18 +69,13 @@ if shopping_cart is not None:
shopping_cart.manage_setLocalRoles(user_id, ['Owner'])
portal.portal_sessions[container.REQUEST['session_id']].update(shopping_cart=shopping_cart)
"""
response = context.REQUEST.RESPONSE
response.setHeader("__ac_name", reference)
response.setHeader("__ac_password", password)
"""
ac = standard_b64encode('%s:%s' % (reference, password))
context.setAuthCookie(container.REQUEST.RESPONSE, '__ac', quote(ac))
came_from = kw.pop('came_from', None)
if came_from:
from ZTUtils import make_query
parameter_string = make_query(__ac_name=reference, __ac_password=password,
portal_status_message=msg, editable_mode=0)
parameter_string = make_query(portal_status_message=msg, editable_mode=0)
return context.REQUEST.RESPONSE.redirect('%s?%s' % (came_from, parameter_string))
return website.Base_redirect('/', keep_items=dict(portal_status_message=msg,
__ac_name=reference, # XXX - Make it generic
__ac_password=password, # XXX - Make it generic
editable_mode=0))
return website.Base_redirect('/', keep_items=dict(portal_status_message=msg,editable_mode=0))
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