From: Benoì‚t Pin <pin@cri.ensmp.fr>
Date: Wed, 31 Jul 2013 10:37:14 +0000 (+0200)
Subject: Ajouts messages de retour du formulaire de demande de réinitialisation de mot de... 
X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/797d6a6d2797c8ff4ac50e7a107c585f838ff282

Ajouts messages de retour du formulaire de demande de réinitialisation de mot de passe.
---

diff --git a/RegistrationTool.py b/RegistrationTool.py
index f34b4a5..f31a5c6 100644
--- a/RegistrationTool.py
+++ b/RegistrationTool.py
@@ -225,6 +225,9 @@ class RegistrationTool(BaseRegistrationTool) :
                                                  charset = 'UTF-8',
                                                  body=body)
             mailhost.send(message)
+            return
+        
+        return _('Unknown user name. Please retry.')
     
     security.declarePrivate('clearExpiredPasswordResetRequests')
     def clearExpiredPasswordResetRequests(self):
diff --git a/skins/generic/request_password_reset_form.py b/skins/generic/request_password_reset_form.py
index 69a34c3..1e9b57c 100644
--- a/skins/generic/request_password_reset_form.py
+++ b/skins/generic/request_password_reset_form.py
@@ -1,13 +1,17 @@
-##parameters=userid='', requestReset=''
+##parameters=userid='', requestReset='', ajax=''
 from Products.CMFCore.utils import getUtilityByInterfaceName
 from Products.Plinn.utils import Message as _
 utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool')
 rtool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IRegistrationTool')
 
 if requestReset :
-    uuid = rtool.requestPasswordReset(userid)
-    context.setStatus(True, _('request for resetting password sent'))
-    return 'yeah !'
+    msg = rtool.requestPasswordReset(userid)
+    if not  msg :
+        context.setStatus(True, _('Request for resetting password sent to your contact email.'))
+        context.setRedirect(utool.getPortalObject(), 'object/view', ajax=ajax)
+        return
+    
+    context.setStatus(False, msg)
 
 options={}
 target = '%s/request_password_reset_form' % utool()