Contents
first idea
If a superuser sends the recovery password token by "Mail account data" the text should be different and may be configurabe from within wikiconfig.
1 diff -r f796dbb7e15b MoinMoin/config/multiconfig.py
2 --- a/MoinMoin/config/multiconfig.py Mon Sep 08 11:58:03 2008 +0200
3 +++ b/MoinMoin/config/multiconfig.py Mon Sep 08 18:59:51 2008 +0200
4 @@ -972,6 +972,9 @@
5 )),
6 # ==========================================================================
7 'various': ('Various', None, (
8 + ('superuser_mail_account_prologue', '', 'preambel of message text the superuser sends with the mail account data form in front of the login password recovery information'),
9 + ('superuser_mail_account_epilogue', '', 'epilog of message text the superuser sends with the mail account data form below the login password recovery information'),
10 +
11 ('bang_meta', True, 'if True, enable {{{!NoWikiName}}} markup'),
12 ('caching_formats', ['text_html'], "output formats that are cached; set to [] to turn off caching (useful for development)"),
13
14 diff -r f796dbb7e15b MoinMoin/user.py
15 --- a/MoinMoin/user.py Mon Sep 08 11:58:03 2008 +0200
16 +++ b/MoinMoin/user.py Mon Sep 08 18:59:51 2008 +0200
17 @@ -1018,6 +1018,7 @@
18 _ = self._request.getText
19
20 tok = self.generate_recovery_token()
21 + sysadm = self._request.form.get('sysadm', [''])[0]
22
23 text = '\n' + _("""\
24 Login Name: %s
25 @@ -1032,7 +1033,12 @@
26 url_quote_plus(self.name),
27 tok, )
28
29 - text = _("""\
30 + if self.valid and sysadm and self._request.cfg.superuser_mail_account_prologue:
31 + text = self._request.cfg.superuser_mail_account_prologue + text
32 + if self._request.cfg.superuser_mail_account_epilogue:
33 + text += self._request.cfg.superuser_mail_account_epilogue
34 + else:
35 + text = _("""\
36 Somebody has requested to email you a password recovery token.
37
38 If you lost your password, please go to the password reset URL below or
39 @@ -1040,7 +1046,6 @@
40 recovery token.
41 """) + text
42
43 -
44 subject = _('[%(sitename)s] Your wiki account data',
45 ) % {'sitename': self._cfg.sitename or "Wiki"}
46 mailok, msg = sendmail.sendmail(self._request, [self.email], subject,
if you set the about parameter in you wikiconfig this text is used for the recoverpass mail if a superuser invokes this action for a user.
e.g.
1 superuser_mail_account_prologue = """Dear colleague,
2
3 Your user account for the wiki page of the XXXX initiative
4 has been set up. Please use the following URL link to reset your
5 password within the next days.
6 """
7 superuser_mail_account_epilogue = """Please also sign the data protocol (f
8 orm available on the wiki page)
9 and send it back to xxxxx or by fax: xxxxx
10 If we do not receive the signed data protocol, we have to disable your
11 account to the page after the deadline displayed on the wiki page in the
12 interest of other users.
13
14 Best Regards,
15 xxxxx"""
Does one know better names for these config vars?
how i use it currently
I also use this in a different approach.
1 diff -r 63016f784d88 MoinMoin/user.py
2 --- a/MoinMoin/user.py Mon Apr 05 23:37:52 2010 +0200
3 +++ b/MoinMoin/user.py Wed Apr 07 13:48:08 2010 +0200
4 @@ -1011,23 +1011,29 @@
5 _ = self._request.getText
6
7 tok = self.generate_recovery_token()
8 -
9 - text = '\n' + _("""\
10 + sysadm = self._request.values.get('sysadm', '')
11 + if self.valid and sysadm and hasattr(self._cfg, "about"):
12 + text = self._request.cfg.about % {"login_name": self.name,
13 + "recovery_token": tok,
14 + "base_url": self._request.url_root,
15 + "user_name": url_quote_plus(self.name)}
16 + else:
17 + text = '\n' + _("""\
18 Login Name: %s
19
20 Password recovery token: %s
21
22 Password reset URL: %s?action=recoverpass&name=%s&token=%s
23 """) % (
24 - self.name,
25 - tok,
26 - self._request.url_root,
27 - url_quote_plus(self.name),
28 - tok, )
29 -
30 - text = _("""\
31 + self.name,
32 + tok,
33 + self._request.url_root,
34 + url_quote_plus(self.name),
35 + tok, )
36 +
37 + text = _("""\
38 Somebody has requested to email you a password recovery token.
39 -
40 +
41 If you lost your password, please go to the password reset URL below or
42 go to the password recovery page again and enter your username and the
43 recovery token.
and an example of the about var in wikiconfig
about = u"""\ Dear colleague, Your user account for the wiki page of the XXXX initiative has been set up. Please use the following URL link to reset your password within the next days. Login Name: %(login_name)s Password recovery token: %(recovery_token)s Password reset URL: %(base_url)s/?action=recoverpass&name=%(user_name)s&token=%(recovery_token)s Please also sign the data protocol (form available on the wiki page) and send it back to XXXX. If we do not receive the signed data protocol, we have to disable your account to the page after the deadline displayed on the wiki page in the interest of other users. Best Regards, XXXX """