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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
ec08314c
Commit
ec08314c
authored
Jun 11, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_advanced_ecommerce: use setAuthCookie
parent
15069e70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
...s/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
+10
-19
No files found.
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/WebSite_createWebSiteAccount.py
View file @
ec08314c
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
))
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