Exemple #1
0
 def lostPassword(self, email='', REQUEST=None, RESPONSE=None):
     """ forgot password """
     errors = []
     if not string.strip(email):
         errors.append(ERROR104)
     pwd = fname = lname = accoount = None
     if email!='':
         for n in self.getUserNames():
             us = self.getUser(n)
             if email.strip() == us.email:
                 pwd = self.getUserPassword(us)
                 fname = self.getUserFirstName(us)
                 lname = self.getUserLastName(us)
                 account = self.getUserAccount(us)
                 break
         if pwd is None:
             errors.append(ERROR117)
     if len(errors):
         if REQUEST is not None: 
             #save form data to session
             self.setUserSession('', '', '', '', email)
             #save error to session
             self.setSessionErrors(errors)
             return REQUEST.RESPONSE.redirect(REQUEST.HTTP_REFERER)
         else:
             return errors
     n = Notification()
     template_text = self.notification.sendpassword.document_src()
     template_html = self.notification.sendpassword_html.document_src()
     if self.notification.sendpassword.title:
         subject = self.notification.sendpassword.title
     elif self.notification.sendpassword_html.title:
         subject = self.notification.sendpassword_html.title
     else:
         subject = "finShare notifications"
     if self.webmaster:
         webmaster = self.webmaster
     else:
         webmaster = "*****@*****.**"
     n.send_passwords(account, email, fname, lname, pwd, webmaster, subject, template_text, template_html)
     if REQUEST is not None and REQUEST.has_key('destination'): 
         return REQUEST.RESPONSE.redirect(REQUEST['destination'] + '?save=ok')