Attachment 'mailAccountData.py'

Download

   1     def mailAccountData(self, cleartext_passwd=None, invitation=False):
   2         from MoinMoin.mail import sendmail
   3         from MoinMoin.wikiutil import getSysPage
   4         _ = self._request.getText
   5 
   6         if not self.enc_password: # generate pw if there is none yet
   7             from random import randint
   8             import base64
   9 
  10             charset = 'utf-8'
  11             pwd = "%s%d" % (str(time.time()), randint(0, 65535))
  12             pwd = pwd.encode(charset)
  13 
  14             pwd = sha.new(pwd).digest()
  15             pwd = '{SHA}%s' % base64.encodestring(pwd).rstrip()
  16 
  17             self.enc_password = pwd
  18             self.save()
  19 
  20         if not invitation:
  21             text = '\n' + _("""\
  22 Login Name: %s
  23 
  24 Login Password: %s
  25 
  26 Login URL: %s/%s?action=login
  27 """, formatted=False) % (
  28                         self.name, self.enc_password, self._request.getBaseURL(), getSysPage(self._request, 'UserPreferences').page_name)
  29 
  30             text = _("""\
  31 Somebody has requested to submit your account data to this email address.
  32 
  33 If you lost your password, please use the data below and just enter the
  34 password AS SHOWN into the wiki's password form field (use copy and paste
  35 for that).
  36 
  37 After successfully logging in, it is of course a good idea to set a new and known password.
  38 """, formatted=False) + text
  39 
  40         else:
  41             text = '\n' + _("""\
  42 Login Name: %s
  43 
  44 Login Password: %s
  45 
  46 Login URL: %s/%s?action=login
  47 """, formatted=False) % (
  48                         self.name, cleartext_passwd, self._request.getBaseURL(), getSysPage(self._request, 'UserPreferences').page_name)
  49 
  50             text = _("""\
  51 Welcome to the %(sitename)s Wiki!
  52 
  53 You are invited to join our wiki community and share your ideas with us.
  54 Please use the login name and password below to log in. To ease login, you can
  55 also use copy and paste.
  56 Please do also make sure that in your browser's settings cookies are enabled
  57 for the login url so that authentications does really work and is kept while
  58 navigating in the wiki.
  59 
  60 After successfully logging in, it is of course a good idea to set a new password
  61 of your choice.
  62 """, formatted=False) % {'sitename': self._cfg.sitename or "Wiki"}  + text
  63 
  64 
  65         subject = _('[%(sitename)s] Your wiki account data',
  66                     formatted=False) % {'sitename': self._cfg.sitename or "Wiki"}
  67         mailok, msg = sendmail.sendmail(self._request, [self.email], subject,
  68                                     text, mail_from=self._cfg.mail_from)
  69         return msg

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-11-25 20:10:35, 1.4 KB) [[attachment:MakeInvitation.py]]
  • [get | view] (2006-12-10 22:20:31, 1.1 KB) [[attachment:MakeInvitation.txt]]
  • [get | view] (2006-12-10 22:20:06, 2.8 KB) [[attachment:MakeInvitation1-6-dev.py]]
  • [get | view] (2008-11-20 08:40:46, 9.3 KB) [[attachment:MakeInvitation_v1.7.2.gif]]
  • [get | view] (2008-11-20 07:33:50, 3.0 KB) [[attachment:MakeInvitation_v1.7.2.py]]
  • [get | view] (2008-11-20 07:34:07, 1.2 KB) [[attachment:MakeInvitation_v1.7.2.txt]]
  • [get | view] (2006-12-10 22:19:33, 2.5 KB) [[attachment:mailAccountData.py]]
  • [get | view] (2006-11-25 20:10:53, 2.3 KB) [[attachment:moin1-5-4-1user.diff]]
  • [get | view] (2006-11-25 20:13:16, 4.1 KB) [[attachment:moin1-5-4-1userform.diff]]
  • [get | view] (2006-12-10 22:19:03, 2.2 KB) [[attachment:user-1-6-dev.diff]]
  • [get | view] (2006-11-25 20:12:10, 33.3 KB) [[attachment:user_moin1-5-4-1_patched.py]]
  • [get | view] (2006-12-10 22:18:31, 1.0 KB) [[attachment:userform.diff]]
  • [get | view] (2006-11-25 20:12:52, 31.5 KB) [[attachment:userform_moin1-5-4-1_patched.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.