Quelques préparatifs avant l'implémentation de l'envoi du rappel.
authorBenoît Pin <pin@cri.ensmp.fr>
Mon, 29 Jul 2013 14:49:50 +0000 (16:49 +0200)
committerBenoît Pin <pin@cri.ensmp.fr>
Mon, 29 Jul 2013 14:49:50 +0000 (16:49 +0200)
RegistrationTool.py
skins/generic/request_password_reset_form.py [new file with mode: 0644]
skins/generic/request_password_reset_template.pt [moved from skins/generic/request_password_reset_form.pt with 86% similarity]

index 7d2f29b..109a0d6 100644 (file)
@@ -204,7 +204,7 @@ class RegistrationTool(BaseRegistrationTool) :
        security.declarePrivate('clearExpiredPasswordResetRequests')
        def clearExpiredPasswordResetRequests(self):
                now = DateTime()
        security.declarePrivate('clearExpiredPasswordResetRequests')
        def clearExpiredPasswordResetRequests(self):
                now = DateTime()
-               for uuid, record in self._passwordResetRequest.items() :
+               for uuid, record in self._passwordResetRequests.items() :
                        userid, date = record
                        if date < now :
                                del self._passwordResetRequests[uuid]
                        userid, date = record
                        if date < now :
                                del self._passwordResetRequests[uuid]
diff --git a/skins/generic/request_password_reset_form.py b/skins/generic/request_password_reset_form.py
new file mode 100644 (file)
index 0000000..69a34c3
--- /dev/null
@@ -0,0 +1,16 @@
+##parameters=userid='', requestReset=''
+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 !'
+
+options={}
+target = '%s/request_password_reset_form' % utool()
+options['action'] = target
+
+return context.request_password_reset_template(**options)
\ No newline at end of file
@@ -20,9 +20,9 @@
           tal:content="ptool/email_from_address" href="mailto:me@here.com"
           i18n:name="admin_email">me@here.com</a>.
         </p>
           tal:content="ptool/email_from_address" href="mailto:me@here.com"
           i18n:name="admin_email">me@here.com</a>.
         </p>
-        <form action="mail_password" tal:attributes="action string:${here/portal_url}/mail_password">
+        <form action="mail_password" tal:attributes="action options/action">
           <input name="userid"/>
           <input name="userid"/>
-          <input type="submit" value=" Send " i18n:attributes="value"/>
+          <input type="submit" name="requestReset" value=" Send " i18n:attributes="value"/>
         </form>
       </div>
     </div>
         </form>
       </div>
     </div>