]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/batcher/templates.py
Begin more work on the batcher.
[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
16 "languages": {
17 "en": {
18 1: {
19 "subject": "New account registration",
20 "body": """
21 Thank you for registering.
22 To get your password please visit:
23 %(url)s
24
25 In case you forget your login/password use:
26 /msg %(config.bot)s REQUESTPASSWORD %(user)s %(user.email)s
27
28 Make sure you've read the %(config.bot)s FAQ FAQ at http://www.quakenet.org for a complete
29 reference on Q's commands and usage.
30
31 ** PLEASE READ http://www.quakenet.org/faq/faq.php?c=160 --
32 it contains important information about keeping your account secure.
33 Note that QuakeNet Operators will not intervene if you fail to read
34 the above URL and your account is compromised as a result.
35
36 PLEASE REMEMBER THAT UNUSED ACCOUNTS ARE AUTOMATICALLY REMOVED
37 AFTER %(config.cleanup)d DAYS, AND ALL CHANLEVS ARE LOST!
38
39 NB: Save this email for future reference.
40 """,
41 },
42 2: { "subject": "Password request", "body": "Your password: %(user.password)s", },
43 3: { "subject": "New password", "body": "Your new password: %(user.password)s", },
44 5: { "subject": "Email change", "body": "Your old email address: %(prevemail)s", },
45 },
46 },
47 }