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.You are not allowed to attach a file to this page.