]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/batcher/templates.py
Add some better emails.
[irc/quakenet/newserv.git] / chanserv / batcher / templates.py
1 import md5, os
2 from rc4 import RC4
3
4 def generate_url(config, obj):
5 s = os.urandom(4)
6 r = RC4(md5.md5("%s %s" % (s, config["urlkey"])).hexdigest())
7 a = r.crypt(obj["user.password"])
8 b = md5.md5(md5.md5("%s %s %s %s" % (config["urlsecret"], obj["user.username"], a, s)).hexdigest()).hexdigest()
9 obj["url"] = "%s?m=%s&h=%s&u=%s&r=%s" % (config["url"], a.encode("hex"), b, obj["user.username"].encode("hex"), s.encode("hex"))
10
11 MAILTEMPLATES = {
12 "mutators": {
13 1: generate_url,
14 },
15 "sendto": {
16 5: "prevemail",
17 },
18 "languages": {
19 "en": {
20 1: {
21 "subject": "%(config.bot)s account registration",
22 "body": """
23 Thank you for registering.
24 To get your password please visit:
25 %(url)s
26
27 In case you forget your login/password use:
28 /msg %(config.bot)s REQUESTPASSWORD %(user.username)s %(user.email)s
29
30 Make sure you've read the %(config.bot)s FAQ at %(config.siteurl)s for a complete
31 reference on Q's commands and usage.
32
33 ** PLEASE READ %(config.securityurl)s --
34 it contains important information about keeping your account secure.
35 Note that QuakeNet Operators will not intervene if you fail to read
36 the above URL and your account is compromised as a result.
37
38 PLEASE REMEMBER THAT UNUSED ACCOUNTS ARE AUTOMATICALLY REMOVED
39 AFTER %(config.cleanup)d DAYS, AND ALL CHANLEVS ARE LOST!
40
41 NB: Save this email for future reference.
42 """,
43 },
44 2: { "subject": "%(config.bot)s password request", "body": """
45 Your username/password is:
46
47 Username: %(user.username)s
48 Password: %(user.password)s
49
50 To auth yourself to %(config.bot)s, type the following command
51
52 /MSG %(config.bot)s@%(config.server)s AUTH %(user.username)s %(user.password)s
53 """, },
54 3: { "subject": "%(config.bot)s password change", "body": "Your new password: %(user.password)s", },
55 5: { "subject": "%(config.bot)s email change", "body": """
56 Your email address has been changed on %(config.bot)s.
57
58 ADD RESET STUFF,
59
60 blah %(user.email)s
61 """, },
62 },
63 },
64 }