r252543 - in Products.cooptation/trunk: Products/cooptation Products/cooptation/locales Products/cooptation/locales/en/LC_MESSAGES Products/cooptation/locales/fr/LC_MESSAGES Products/cooptation/skins/cooptation_templates docs

"Vincent Fretin" <svn-changes-z4DKO/[email protected]> Mon, 16 Sep 2013 09:18:44 +0000 (UTC)
Newsgroups gmane.comp.web.zope.plone.collective.cvs
Message-ID <[email protected]>
Author: vincentfretin
Date: Mon Sep 16 09:18:44 2013
New Revision: 252543

Modified:
   Products.cooptation/trunk/Products/cooptation/locales/cooptation.pot
   Products.cooptation/trunk/Products/cooptation/locales/en/LC_MESSAGES/cooptation.po
   Products.cooptation/trunk/Products/cooptation/locales/fr/LC_MESSAGES/cooptation.po
   Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_edit.pt
   Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_password_notification.pt
   Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_register.cpy
   Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_validate.vpy
   Products.cooptation/trunk/Products/cooptation/wfsubscribers.py
   Products.cooptation/trunk/docs/HISTORY.txt
Log:
Don't send password in the mail but a link to choose the password.

Modified: Products.cooptation/trunk/Products/cooptation/locales/cooptation.pot
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/locales/cooptation.pot	(original)
+++ Products.cooptation/trunk/Products/cooptation/locales/cooptation.pot	Mon Sep 16 09:18:44 2013
@@ -3,7 +3,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: cooptation\n"
-"POT-Creation-Date: 2013-03-17 21:29+0000\n"
+"POT-Creation-Date: 2013-09-16 07:42+0000\n"
 "PO-Revision-Date: Fri Jan 16 11:58:33 2009\n"
 "Last-Translator: Vincent Fretin and Michael Launay <[email protected]>\n"
 "Language-Team: Vincent Fretin and Michael Launay <[email protected]>\n"
@@ -21,12 +21,12 @@
 msgstr ""
 
 #. Default: "${actor_fullname} has accepted to coopt \"${content_name}\" at ${content_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:24
 msgid "cooptation_accepted_body"
 msgstr ""
 
 #. Default: "Cooptation of ${content_name} accepted"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:10
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:12
 msgid "cooptation_accepted_subject"
 msgstr ""
 
@@ -41,27 +41,22 @@
 msgstr ""
 
 #. Default: "Your user account has been created on ${sitename} at the request of ${reviewer_name}."
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:29
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:31
 msgid "cooptation_password_body1"
 msgstr ""
 
 #. Default: "Your login: ${username}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:37
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:39
 msgid "cooptation_password_body2"
 msgstr ""
 
-#. Default: "Your password: ${password}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:42
+#. Default: "Please activate it by visiting ${set_password} Please activate your account before ${expirationdate}"
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:47
 msgid "cooptation_password_body3"
 msgstr ""
 
-#. Default: "Please log in to ${url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:48
-msgid "cooptation_password_body4"
-msgstr ""
-
 #. Default: "Creation of your account"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:15
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:17
 msgid "cooptation_password_subject"
 msgstr ""
 
@@ -76,15 +71,15 @@
 msgstr ""
 
 #. Default: "With kind regards,"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:34
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:63
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:35
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:62
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:26
 msgid "greetings"
 msgstr ""
 
 #. Default: "Hello ${recipient_to_name},"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:17
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:19
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:24
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:17
 msgid "hello"
 msgstr ""
@@ -110,7 +105,7 @@
 msgstr ""
 
 #. Default: "This user has now the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:30
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:31
 msgid "user_has_role_on_workspace"
 msgstr ""
 
@@ -120,7 +115,7 @@
 msgstr ""
 
 #. Default: "You have the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:57
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:56
 msgid "you_have_role_on_workspace"
 msgstr ""
 

Modified: Products.cooptation/trunk/Products/cooptation/locales/en/LC_MESSAGES/cooptation.po
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/locales/en/LC_MESSAGES/cooptation.po	(original)
+++ Products.cooptation/trunk/Products/cooptation/locales/en/LC_MESSAGES/cooptation.po	Mon Sep 16 09:18:44 2013
@@ -3,7 +3,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: cooptation\n"
-"POT-Creation-Date: 2013-03-17 21:29+0000\n"
+"POT-Creation-Date: 2013-09-16 07:42+0000\n"
 "PO-Revision-Date: 2009-01-15 10:58+0100\n"
 "Last-Translator: Vincent Fretin <[email protected]>\n"
 "Language-Team: French\n"
@@ -21,12 +21,12 @@
 msgstr ""
 
 #. Default: "${actor_fullname} has accepted to coopt \"${content_name}\" at ${content_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:24
 msgid "cooptation_accepted_body"
 msgstr ""
 
 #. Default: "Cooptation of ${content_name} accepted"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:10
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:12
 msgid "cooptation_accepted_subject"
 msgstr ""
 
@@ -41,27 +41,22 @@
 msgstr ""
 
 #. Default: "Your user account has been created on ${sitename} at the request of ${reviewer_name}."
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:29
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:31
 msgid "cooptation_password_body1"
 msgstr ""
 
 #. Default: "Your login: ${username}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:37
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:39
 msgid "cooptation_password_body2"
 msgstr ""
 
-#. Default: "Your password: ${password}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:42
+#. Default: "Please activate it by visiting ${set_password} Please activate your account before ${expirationdate}"
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:47
 msgid "cooptation_password_body3"
 msgstr ""
 
-#. Default: "Please log in to ${url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:48
-msgid "cooptation_password_body4"
-msgstr ""
-
 #. Default: "Creation of your account"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:15
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:17
 msgid "cooptation_password_subject"
 msgstr ""
 
@@ -76,15 +71,15 @@
 msgstr ""
 
 #. Default: "With kind regards,"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:34
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:63
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:35
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:62
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:26
 msgid "greetings"
 msgstr ""
 
 #. Default: "Hello ${recipient_to_name},"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:17
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:19
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:24
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:17
 msgid "hello"
 msgstr ""
@@ -110,7 +105,7 @@
 msgstr ""
 
 #. Default: "This user has now the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:30
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:31
 msgid "user_has_role_on_workspace"
 msgstr ""
 
@@ -120,7 +115,7 @@
 msgstr ""
 
 #. Default: "You have the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:57
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:56
 msgid "you_have_role_on_workspace"
 msgstr ""
 

Modified: Products.cooptation/trunk/Products/cooptation/locales/fr/LC_MESSAGES/cooptation.po
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/locales/fr/LC_MESSAGES/cooptation.po	(original)
+++ Products.cooptation/trunk/Products/cooptation/locales/fr/LC_MESSAGES/cooptation.po	Mon Sep 16 09:18:44 2013
@@ -2,8 +2,8 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: cooptation\n"
-"POT-Creation-Date: 2013-03-17 21:29+0000\n"
-"PO-Revision-Date: 2013-03-17 22:30+0100\n"
+"POT-Creation-Date: 2013-09-16 07:42+0000\n"
+"PO-Revision-Date: 2013-09-16 09:44+0100\n"
 "Last-Translator: Vincent Fretin <[email protected]>\n"
 "Language-Team: French\n"
 "MIME-Version: 1.0\n"
@@ -20,12 +20,12 @@
 msgstr "Cet utilisateur sera automatiquement ajouté à l'espace de travail ${workspace_url} en tant que ${role}."
 
 #. Default: "${actor_fullname} has accepted to coopt \"${content_name}\" at ${content_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:24
 msgid "cooptation_accepted_body"
 msgstr "${actor_fullname} a accepté l'ajout du nouveau membre \"${content_name}\" demandé à ${content_url}"
 
 #. Default: "Cooptation of ${content_name} accepted"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:10
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:12
 msgid "cooptation_accepted_subject"
 msgstr "Acceptation d'ajout du membre ${content_name}"
 
@@ -40,27 +40,22 @@
 msgstr "Demande d'ajout du nouveau membre ${content_name}"
 
 #. Default: "Your user account has been created on ${sitename} at the request of ${reviewer_name}."
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:29
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:31
 msgid "cooptation_password_body1"
 msgstr "Votre compte utilisateur a été créé sur l'outil collaboratif ${sitename} à la demande de ${reviewer_name}."
 
 #. Default: "Your login: ${username}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:37
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:39
 msgid "cooptation_password_body2"
 msgstr "Votre login : ${username}"
 
-#. Default: "Your password: ${password}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:42
+#. Default: "Please activate it by visiting ${set_password} Please activate your account before ${expirationdate}"
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:47
 msgid "cooptation_password_body3"
-msgstr "Votre mot de passe : ${password}"
-
-#. Default: "Please log in to ${url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:48
-msgid "cooptation_password_body4"
-msgstr "Vous pouvez vous connecter à l'adresse ${url}"
+msgstr "Veuillez activer votre compte en visitant ${set_password} avant le ${expirationdate}."
 
 #. Default: "Creation of your account"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:15
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:17
 msgid "cooptation_password_subject"
 msgstr "Création de votre compte"
 
@@ -75,15 +70,15 @@
 msgstr "Refus d'ajout du nouveau membre ${content_name}"
 
 #. Default: "With kind regards,"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:34
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:63
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:35
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:62
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:26
 msgid "greetings"
 msgstr "Cordialement"
 
 #. Default: "Hello ${recipient_to_name},"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:17
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:22
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:19
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:24
 #: ./skins/cooptation_templates/cooptation_pending_notification.pt:17
 msgid "hello"
 msgstr "Bonjour ${recipient_to_name},"
@@ -109,7 +104,7 @@
 msgstr "Raison"
 
 #. Default: "This user has now the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:30
+#: ./skins/cooptation_templates/cooptation_accepted_notification.pt:31
 msgid "user_has_role_on_workspace"
 msgstr "Cet utilisateur est maintenant ${role} sur l'espace de travail \"${workspace_title}\" disponible à cette adresse : ${workspace_url}"
 
@@ -119,7 +114,7 @@
 msgstr "Message de bienvenue pour le coopté"
 
 #. Default: "You have the role ${role} on the workspace \"${workspace_title}\" available at this url: ${workspace_url}"
-#: ./skins/cooptation_templates/cooptation_password_notification.pt:57
+#: ./skins/cooptation_templates/cooptation_password_notification.pt:56
 msgid "you_have_role_on_workspace"
 msgstr "Vous êtes ${role} sur l'espace de travail \"${workspace_title}\", disponible à cette adresse : ${workspace_url}"
 

Modified: Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_edit.pt
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_edit.pt	(original)
+++ Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_edit.pt	Mon Sep 16 09:18:44 2013
@@ -19,63 +19,6 @@
                     member context/@@plone_portal_state/member;">
       <div class="field"
            i18n:domain="plone"
-           tal:condition="python:wf_state == 'pending' and member.has_permission('Review portal content', context) and request.get('action', 'unknown')!='reject'"
-           tal:define="error errors/password | nothing;
-                       password request/password | nothing;"
-           tal:attributes="class python:test(error, 'field error', 'field')">
-
-        <label for="password"
-               i18n:translate="label_password">Password</label>
-
-        <span class="fieldRequired" title="Required"
-              i18n:attributes="title title_required;"
-              i18n:translate="label_required">(Required)</span>
-
-              <div class="formHelp" i18n:translate="help_password_creation">
-                Minimum 5 characters.
-              </div>
-
-              <div tal:content="error">Validation error output</div>
-
-              <input type="password"
-                     name="password"
-                     id="password"
-                     size="10"
-                     value=""
-                     />
-      </div>
-
-      <div class="field"
-           i18n:domain="plone"
-           tal:condition="python:wf_state == 'pending' and member.has_permission('Review portal content', context) and request.get('action', 'unknown')!='reject'"
-           tal:define="error errors/password_confirm | nothing;
-                       password_confirm request/password_confirm | nothing;"
-           tal:attributes="class python:test(error, 'field error', 'field')">
-
-
-        <label for="password_confirm"
-               i18n:translate="label_confirm_password">Confirm password</label>
-
-        <span class="fieldRequired" title="Required"
-              i18n:attributes="title title_required;"
-              i18n:translate="label_required">(Required)</span>
-
-              <div class="formHelp" i18n:translate="help_confirm_password">
-                Re-enter the password. Make sure the passwords are identical.
-              </div>
-
-              <div tal:content="error">Validation error output</div>
-
-              <input type="password"
-                     name="password_confirm"
-                     id="password_confirm"
-                     size="10"
-                     value=""
-                     />
-      </div>
-
-      <div class="field"
-           i18n:domain="plone"
            tal:condition="python:wf_state == 'pending' and member.has_permission('Review portal content', context)">
         <label for="comment" 
                i18n:translate="label_comments">Comments</label>

Modified: Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_password_notification.pt
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_password_notification.pt	(original)
+++ Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_password_notification.pt	Mon Sep 16 09:18:44 2013
@@ -6,7 +6,7 @@
                   recipient_to_name python:options['recipient_to_name'];
                   reviewer_name python:options['reviewer_name'];
                   username python:options['username'];
-                  password python:options['password'];
+                  reset python:options['reset'];
                   portal_url python:options['portal_url'];
                   workspace python:options.get('workspace', None) or context.getWorkspace();
                   role python:options.get('role', None) or context.getRole();
@@ -41,13 +41,11 @@
 <div i18n:domain="cooptation"
      i18n:translate="cooptation_password_body3"
      tal:omit-tag="">
-Your password: <span i18n:name="password" tal:replace="password" />
-</div>
-
-<div i18n:domain="cooptation"
-     i18n:translate="cooptation_password_body4"
-     tal:omit-tag="">
-Please log in to <span i18n:name="url" tal:replace="portal_url" />
+Please activate it by visiting
+<span i18n:name="set_password" tal:replace="python:portal.pwreset_constructURL(reset['randomstring'])+'?userid='+username" />
+                                                                                
+    Please activate your account before <span i18n:name="expirationdate" tal:replace="python:
+    context.toLocalizedTime(reset['expires'], long_format=1)" />
 </div>
 
 <div i18n:domain="cooptation"

Modified: Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_register.cpy
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_register.cpy	(original)
+++ Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_register.cpy	Mon Sep 16 09:18:44 2013
@@ -5,7 +5,7 @@
 ##bind script=script
 ##bind state=state
 ##bind subpath=traverse_subpath
-##parameters=password='password', password_confirm='password_confirm', came_from_prefs=None
+##parameters=
 ##title=Register a User
 ##
 
@@ -21,8 +21,7 @@
 portal_registration = context.portal_registration
 
 username = REQUEST['username']
-
-password = REQUEST.get('password')
+password = portal_registration.generatePassword()
 
 # This is a temporary work-around for an issue with CMF not properly
 # reserving some existing ids (FSDV skin elements, for example). Until
@@ -42,7 +41,6 @@
 notifyCooptationToUser(context,
                  recipients=[member],
                  username=username,
-                 password=password,
                  portal_url=portal.absolute_url())
 
 portal_workflow = getToolByName(context, 'portal_workflow')

Modified: Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_validate.vpy
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_validate.vpy	(original)
+++ Products.cooptation/trunk/Products/cooptation/skins/cooptation_templates/cooptation_validate.vpy	Mon Sep 16 09:18:44 2013
@@ -5,7 +5,7 @@
 ##bind script=script
 ##bind state=state
 ##bind subpath=traverse_subpath
-##parameters=username='',email='',password='',password_confirm=''
+##parameters=
 ##title=validates the Registration of a User
 
 # modified copy of join_form_validate.vpy
@@ -14,6 +14,8 @@
 from Products.CMFCore.utils import getToolByName
 
 request = context.REQUEST
+username = request.form.get('username', '')
+email = request.form.get('email', '')
 if request.form.get('edb_entite', None):
     if not isinstance(request.form['edb_entite'], (str, unicode)):
         request.form['edb_entite'] = request.form['edb_entite'][0]
@@ -21,10 +23,6 @@
 reg_tool=context.portal_registration
 def missing(field):
     state.setError(field, PMF(u'This field is required, please provide some information.'), 'input_required')
-def nomatch(field):
-    state.setError(field, PMF(u'Passwords do not match.'), 'nomatch_password')
-def minlimit(field):
-    state.setError(field, PMF(u'Passwords must contain at least 5 letters.'), 'min_password')
 def notallowed(field):
     state.setError(field, PMF(u'This username is reserved. Please choose a different name.'), 'not_allowed')
 
@@ -41,18 +39,10 @@
     if username and username == portal.getId():
         notallowed('username')
 
-    if password!=password_confirm:
-        nomatch('password')
-        nomatch('password_confirm')
-
-    if not state.getError('password') and len(password) < 5:
-        minlimit('password')
-        minlimit('password_confirm')
-
     if not state.getError('username') and not reg_tool.isMemberIdAllowed(username):
         state.setError('username',
-	              PMF(u'The login name you selected is already in use or is not valid. Please choose another.'),
-	              'username_invalid' )
+              PMF(u'The login name you selected is already in use or is not valid. Please choose another.'),
+              'username_invalid' )
 
 if state.getErrors():
     context.plone_utils.addPortalMessage(PMF(u'Please correct the indicated errors.'), 'error')

Modified: Products.cooptation/trunk/Products/cooptation/wfsubscribers.py
==============================================================================
--- Products.cooptation/trunk/Products/cooptation/wfsubscribers.py	(original)
+++ Products.cooptation/trunk/Products/cooptation/wfsubscribers.py	Mon Sep 16 09:18:44 2013
@@ -14,6 +14,7 @@
 
 
 ##code-section module-header #fill in your manual code here
+from email import message_from_string
 from Products.CMFCore.utils import getToolByName
 ##/code-section module-header
 
@@ -66,9 +67,13 @@
         gtool = getToolByName(obj, 'portal_groups')
         username = kwargs['username']
         gtool.addPrincipalToGroup(username, groupname)
+
     owner = obj.getOwner()
+    pwrt = getToolByName(obj, 'portal_password_reset')
+    reset = pwrt.requestReset(username)
     kwargs['reviewer_name'] = owner.getProperty('fullname', None) or owner.getId()
-    notifyCooptation(obj, 'cooptation_password_notification', actor=actor, recipients=recipients, **kwargs)
+    notifyCooptation(obj, 'cooptation_password_notification', actor=actor, recipients=recipients, reset=reset, **kwargs)
+
 
 def notifyCooptation(obj, template_name, actor=None, recipients=None, **kwargs):
     """if not actor use AUTHENTICATED_USER
@@ -88,15 +93,24 @@
             recipient_email = recipient.getProperty('email', None)
             recipient_fullname = recipient.getProperty('fullname', None) or recipient.getId()
             if recipient_email:
-                message = template(obj,
-                                   obj.REQUEST,
-                                   actor_fullname=actor_fullname,
-                                   actor_email=actor_email,
-                                   recipient_to_email=recipient_email,
-                                   recipient_to_name=recipient_fullname,
-                                   **kwargs)
-
-                MailHost.send(message.encode(encoding))
+                mail_text = template(obj,
+                                     obj.REQUEST,
+                                     actor_fullname=actor_fullname,
+                                     actor_email=actor_email,
+                                     recipient_to_email=recipient_email,
+                                     recipient_to_name=recipient_fullname,
+                                     **kwargs)
+                # The mail headers are not properly encoded we need to extract
+                # them and let MailHost manage the encoding.
+                if isinstance(mail_text, unicode):
+                    mail_text = mail_text.encode(encoding)
+                message_obj = message_from_string(mail_text.strip())
+                subject = message_obj['Subject']
+                m_to = message_obj['To']
+                m_from = message_obj['From']
+                msg_type = message_obj.get('Content-Type', 'text/plain')
+                MailHost.send(mail_text, m_to, m_from, subject=subject,
+                    charset=encoding, msg_type=msg_type, immediate=True)
 
 
 ##code-section module-footer #fill in your manual code here

Modified: Products.cooptation/trunk/docs/HISTORY.txt
==============================================================================
--- Products.cooptation/trunk/docs/HISTORY.txt	(original)
+++ Products.cooptation/trunk/docs/HISTORY.txt	Mon Sep 16 09:18:44 2013
@@ -4,7 +4,7 @@
 1.4.2 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Don't send password in the mail but a link to choose the password.
 
 
 1.4.1 (2013-04-01)

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Collective-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/collective-checkins