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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
erp5
Commits
0a394578
Commit
0a394578
authored
Aug 30, 2011
by
Aurel
Committed by
Kazuhiko Shiozaki
Aug 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make generation of reset url configurable through a type base script
parent
84e59af2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
product/ERP5/Tool/PasswordTool.py
product/ERP5/Tool/PasswordTool.py
+15
-9
No files found.
product/ERP5/Tool/PasswordTool.py
View file @
0a394578
...
@@ -39,7 +39,6 @@ import time, random
...
@@ -39,7 +39,6 @@ import time, random
from
hashlib
import
md5
as
md5_new
from
hashlib
import
md5
as
md5_new
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
Acquisition
import
aq_base
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Globals
import
PersistentMapping
from
urllib
import
urlencode
from
urllib
import
urlencode
...
@@ -90,19 +89,26 @@ class PasswordTool(BaseTool):
...
@@ -90,19 +89,26 @@ class PasswordTool(BaseTool):
return
key
return
key
security
.
declareProtected
(
'Manage users'
,
'getResetPasswordUrl'
)
security
.
declareProtected
(
'Manage users'
,
'getResetPasswordUrl'
)
def
getResetPasswordUrl
(
self
,
user_login
=
None
,
key
=
None
,
site_url
):
def
getResetPasswordUrl
(
self
,
user_login
=
None
,
key
=
None
,
site_url
=
None
):
if
user_login
is
not
None
:
if
user_login
is
not
None
:
# XXX Backward compatibility
# XXX Backward compatibility
key
=
self
.
getResetPasswordKey
(
user_login
)
key
=
self
.
getResetPasswordKey
(
user_login
)
parameter
=
urlencode
(
dict
(
reset_key
=
reset_key
,
parameter
=
urlencode
(
dict
(
reset_key
=
key
))
user_login
=
user_login
))
method
=
self
.
_getTypeBasedMethod
(
"getSiteUrl"
)
url
=
"%s/portal_password/%s?%s"
%
(
if
method
is
not
None
:
site_url
,
base_url
=
method
()
'PasswordTool_viewResetPassword'
,
else
:
parameter
)
base_url
=
"%s/portal_password/PasswordTool_viewResetPassword"
%
(
site_url
,)
url
=
"%s?%s"
%
(
base_url
,
parameter
)
return
url
return
url
security
.
declareProtected
(
'Manage users'
,
'getResetPasswordUrl'
)
def
getExpirationDateForKey
(
self
,
key
=
None
):
return
self
.
_password_request_dict
[
key
][
1
]
def
mailPasswordResetRequest
(
self
,
user_login
=
None
,
REQUEST
=
None
,
def
mailPasswordResetRequest
(
self
,
user_login
=
None
,
REQUEST
=
None
,
notification_message
=
None
,
sender
=
None
,
notification_message
=
None
,
sender
=
None
,
store_as_event
=
False
):
store_as_event
=
False
):
...
@@ -160,7 +166,7 @@ class PasswordTool(BaseTool):
...
@@ -160,7 +166,7 @@ class PasswordTool(BaseTool):
# send mail
# send mail
message_dict
=
{
'instance_name'
:
self
.
getPortalObject
().
getTitle
(),
message_dict
=
{
'instance_name'
:
self
.
getPortalObject
().
getTitle
(),
'reset_password_link'
:
url
,
'reset_password_link'
:
url
,
'expiration_date'
:
self
.
_password_request_dict
[
key
][
1
]
}
'expiration_date'
:
self
.
getExpirationDateForKey
(
key
).
strftime
(
'%Y/%m/%d %H:%M'
)
}
if
notification_message
is
None
:
if
notification_message
is
None
:
subject
=
translateString
(
"[${instance_name}] Reset of your password"
,
subject
=
translateString
(
"[${instance_name}] Reset of your password"
,
...
...
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