Commit 01f31089 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

PasswordTool: Use of site URL as a parameter and dynamic title

parent 419a5758
...@@ -90,7 +90,7 @@ class PasswordTool(BaseTool): ...@@ -90,7 +90,7 @@ class PasswordTool(BaseTool):
parameter = urlencode(dict(reset_key=key)) parameter = urlencode(dict(reset_key=key))
method = self._getTypeBasedMethod("getSiteUrl") method = self._getTypeBasedMethod("getSiteUrl")
if method is not None: if method is not None:
base_url = method() base_url = method(site_url)
else: else:
base_url = "%s/portal_password/PasswordTool_viewResetPassword" % ( base_url = "%s/portal_password/PasswordTool_viewResetPassword" % (
site_url,) site_url,)
...@@ -106,7 +106,8 @@ class PasswordTool(BaseTool): ...@@ -106,7 +106,8 @@ class PasswordTool(BaseTool):
notification_message=None, sender=None, notification_message=None, sender=None,
store_as_event=False, store_as_event=False,
expiration_date=None, expiration_date=None,
substitution_method_parameter_dict=None): substitution_method_parameter_dict=None,
site_url=None):
""" """
Create a random string and expiration date for request Create a random string and expiration date for request
Parameters: Parameters:
...@@ -128,9 +129,10 @@ class PasswordTool(BaseTool): ...@@ -128,9 +129,10 @@ class PasswordTool(BaseTool):
if user_login is None: if user_login is None:
user_login = REQUEST["user_login"] user_login = REQUEST["user_login"]
site_url = self.getPortalObject().absolute_url() if not site_url:
if REQUEST and 'came_from' in REQUEST: site_url = self.getPortalObject().absolute_url()
site_url = REQUEST.came_from if REQUEST and 'came_from' in REQUEST:
site_url = REQUEST.came_from
msg = None msg = None
# check user exists, and have an email # check user exists, and have an email
...@@ -187,7 +189,7 @@ class PasswordTool(BaseTool): ...@@ -187,7 +189,7 @@ class PasswordTool(BaseTool):
message_text_format = 'text/plain' message_text_format = 'text/plain'
else: else:
message_text_format = notification_message.getContentType() message_text_format = notification_message.getContentType()
subject = notification_message.getTitle() subject = notification_message.asSubjectText(substitution_method_parameter_dict=message_dict)
if message_text_format == "text/html": if message_text_format == "text/html":
message = notification_message.asEntireHTML(substitution_method_parameter_dict=message_dict) message = notification_message.asEntireHTML(substitution_method_parameter_dict=message_dict)
else: else:
......
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