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
francois
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
from
hashlib
import
md5
as
md5_new
from
DateTime
import
DateTime
from
Products.ERP5Type.Message
import
translateString
from
Acquisition
import
aq_base
from
Products.ERP5Type.Globals
import
PersistentMapping
from
urllib
import
urlencode
...
...
@@ -90,19 +89,26 @@ class PasswordTool(BaseTool):
return
key
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
:
# XXX Backward compatibility
key
=
self
.
getResetPasswordKey
(
user_login
)
parameter
=
urlencode
(
dict
(
reset_key
=
reset_key
,
user_login
=
user_login
))
url
=
"%s/portal_password/%s?%s"
%
(
site_url
,
'PasswordTool_viewResetPassword'
,
parameter
)
parameter
=
urlencode
(
dict
(
reset_key
=
key
))
method
=
self
.
_getTypeBasedMethod
(
"getSiteUrl"
)
if
method
is
not
None
:
base_url
=
method
()
else
:
base_url
=
"%s/portal_password/PasswordTool_viewResetPassword"
%
(
site_url
,)
url
=
"%s?%s"
%
(
base_url
,
parameter
)
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
,
notification_message
=
None
,
sender
=
None
,
store_as_event
=
False
):
...
...
@@ -160,7 +166,7 @@ class PasswordTool(BaseTool):
# send mail
message_dict
=
{
'instance_name'
:
self
.
getPortalObject
().
getTitle
(),
'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
:
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