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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
6433544c
Commit
6433544c
authored
Dec 23, 2011
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop Configurator Key implementation
Configurator Key is a legacy.
parent
9a74e608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
57 deletions
+14
-57
product/ERP5Configurator/Tool/ConfiguratorTool.py
product/ERP5Configurator/Tool/ConfiguratorTool.py
+14
-57
No files found.
product/ERP5Configurator/Tool/ConfiguratorTool.py
View file @
6433544c
...
@@ -142,68 +142,31 @@ class ConfiguratorTool(BaseTool):
...
@@ -142,68 +142,31 @@ class ConfiguratorTool(BaseTool):
######################################################
######################################################
def
login
(
self
,
REQUEST
):
def
login
(
self
,
REQUEST
):
""" Login client and show next form. """
""" Login client and show next form. """
password
=
REQUEST
.
get
(
'field_my_ac_key'
,
''
)
bc
=
REQUEST
.
get
(
'field_your_business_configuration'
)
bc
=
REQUEST
.
get
(
'field_your_business_configuration'
)
if
self
.
_isCorrectConfigurationKey
(
password
,
bc
):
user_preferred_language
=
REQUEST
.
get
(
# set user preferred configuration language
'field_my_user_preferred_language'
,
None
)
user_preferred_language
=
REQUEST
.
get
(
if
user_preferred_language
:
'field_my_user_preferred_language'
,
None
)
# Set language value to request so that next page after login
if
user_preferred_language
:
# can get the value. Because cookie value is available from
# Set language value to request so that next page after login
# next request.
# can get the value. Because cookie value is available from
REQUEST
.
set
(
LANGUAGE_COOKIE_NAME
,
user_preferred_language
)
# next request.
REQUEST
.
RESPONSE
.
setCookie
(
LANGUAGE_COOKIE_NAME
,
REQUEST
.
set
(
LANGUAGE_COOKIE_NAME
,
user_preferred_language
)
REQUEST
.
RESPONSE
.
setCookie
(
LANGUAGE_COOKIE_NAME
,
user_preferred_language
,
user_preferred_language
,
path
=
'/'
,
path
=
'/'
,
expires
=
(
DateTime
()
+
30
).
rfc822
())
expires
=
(
DateTime
()
+
30
).
rfc822
())
# set encoded __ac_key cookie at client's browser
__ac_key
=
quote
(
encodestring
(
password
))
expires
=
(
DateTime
()
+
1
).
toZone
(
'GMT'
).
rfc822
()
REQUEST
.
RESPONSE
.
setCookie
(
'__ac_key'
,
__ac_key
,
expires
=
expires
)
REQUEST
.
set
(
'__ac_key'
,
__ac_key
)
REQUEST
.
RESPONSE
.
setCookie
(
BUSINESS_CONFIGURATION_COOKIE_NAME
,
bc
,
expires
=
expires
)
REQUEST
.
set
(
BUSINESS_CONFIGURATION_COOKIE_NAME
,
bc
)
return
self
.
next
(
REQUEST
=
REQUEST
)
else
:
REQUEST
.
set
(
'portal_status_message'
,
self
.
Base_translateString
(
'Incorrect Configuration Key'
))
return
self
.
view
()
def
_isCorrectConfigurationKey
(
self
,
password
=
None
,
expires
=
(
DateTime
()
+
1
).
toZone
(
'GMT'
).
rfc822
()
business_configuration
=
None
):
REQUEST
.
RESPONSE
.
setCookie
(
BUSINESS_CONFIGURATION_COOKIE_NAME
,
""" Is configuration key correct """
bc
,
if
password
is
None
:
expires
=
expires
)
password
=
self
.
REQUEST
.
get
(
'__ac_key'
,
None
)
REQUEST
.
set
(
BUSINESS_CONFIGURATION_COOKIE_NAME
,
bc
)
else
:
return
self
.
next
(
REQUEST
=
REQUEST
)
password
=
quote
(
encodestring
(
password
))
# Not still not finished yet.
if
business_configuration
is
None
:
business_configuration
=
self
.
REQUEST
.
get
(
BUSINESS_CONFIGURATION_COOKIE_NAME
,
None
)
if
None
not
in
[
password
,
business_configuration
]:
def
is_key_valid
(
password
,
business_configuration
):
bc
=
self
.
getPortalObject
().
unrestrictedTraverse
(
business_configuration
)
return
quote
(
encodestring
(
bc
.
getReference
(
''
)))
==
password
return
CachingMethod
(
is_key_valid
,
"ConfiguratorTool_is_key_valid"
,
cache_factory
=
'erp5_content_long'
)(
password
,
business_configuration
)
return
False
#security.declareProtected(Permissions.ModifyPortalContent, 'next')
#security.declareProtected(Permissions.ModifyPortalContent, 'next')
def
next
(
self
,
REQUEST
):
def
next
(
self
,
REQUEST
):
""" Validate settings and return a new form to the user. """
""" Validate settings and return a new form to the user. """
# check if user is allowed to access service
# check if user is allowed to access service
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
if
not
self
.
_isCorrectConfigurationKey
():
REQUEST
.
set
(
'portal_status_message'
,
self
.
Base_translateString
(
'Incorrect Configuration Key'
))
return
self
.
view
()
kw
=
self
.
REQUEST
.
form
.
copy
()
kw
=
self
.
REQUEST
.
form
.
copy
()
business_configuration
=
REQUEST
.
get
(
BUSINESS_CONFIGURATION_COOKIE_NAME
)
business_configuration
=
REQUEST
.
get
(
BUSINESS_CONFIGURATION_COOKIE_NAME
)
bc
=
portal
.
restrictedTraverse
(
business_configuration
)
bc
=
portal
.
restrictedTraverse
(
business_configuration
)
...
@@ -382,10 +345,6 @@ class ConfiguratorTool(BaseTool):
...
@@ -382,10 +345,6 @@ class ConfiguratorTool(BaseTool):
""" Display the previous form. """
""" Display the previous form. """
# check if user is allowed to access service
# check if user is allowed to access service
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
if
not
self
.
_isCorrectConfigurationKey
():
REQUEST
.
set
(
'portal_status_message'
,
self
.
Base_translateString
(
'Incorrect Configuration Key'
))
return
self
.
view
()
kw
=
self
.
REQUEST
.
form
.
copy
()
kw
=
self
.
REQUEST
.
form
.
copy
()
business_configuration
=
REQUEST
.
get
(
BUSINESS_CONFIGURATION_COOKIE_NAME
)
business_configuration
=
REQUEST
.
get
(
BUSINESS_CONFIGURATION_COOKIE_NAME
)
bc
=
portal
.
restrictedTraverse
(
business_configuration
)
bc
=
portal
.
restrictedTraverse
(
business_configuration
)
...
@@ -461,8 +420,6 @@ class ConfiguratorTool(BaseTool):
...
@@ -461,8 +420,6 @@ class ConfiguratorTool(BaseTool):
installation_status
[
'activity_list'
]
=
[]
installation_status
[
'activity_list'
]
=
[]
active_process
=
self
.
portal_activities
.
newActiveProcess
()
active_process
=
self
.
portal_activities
.
newActiveProcess
()
REQUEST
.
set
(
'active_process_id'
,
active_process
.
getId
())
REQUEST
.
set
(
'active_process_id'
,
active_process
.
getId
())
request_restore_dict
=
{
'__ac_key'
:
REQUEST
.
get
(
'__ac_key'
,
None
),
}
self
.
activate
(
active_process
=
active_process
,
tag
=
'initialERP5Setup'
self
.
activate
(
active_process
=
active_process
,
tag
=
'initialERP5Setup'
).
initialERP5Setup
(
business_configuration
.
getRelativeUrl
(),
request_restore_dict
)
).
initialERP5Setup
(
business_configuration
.
getRelativeUrl
(),
request_restore_dict
)
return
self
.
ConfiguratorTool_viewInstallationStatus
(
REQUEST
)
return
self
.
ConfiguratorTool_viewInstallationStatus
(
REQUEST
)
...
...
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