[Mailman-Developers] Per-user monthly password reminders [Patch]

Tollef Fog Heen tollef@add.no
24 Mar 2001 02:58:14 +0100


This is a patch against 2.0.3 to enable per-user monthly password
reminders.  This is a _very_ sought-after feature request from the
Debian community. :)

As I don't have CVS access, I'd appreciate if somebody could review
and apply.  Thanks. :)

--- mailman-2.0.3.orig/Mailman/Defaults.py.in
+++ mailman-2.0.3/Mailman/Defaults.py.in
@@ -531,6 +531,7 @@
 AcknowledgePosts    = 4
 DisableMime         = 8 # Digesters only
 ConcealSubscription = 16
+PasswordReminder    = 32
 
 # Useful directories
 LIST_DATA_DIR	= os.path.join(VAR_PREFIX, 'lists')
--- mailman-2.0.3.orig/Mailman/Cgi/options.py
+++ mailman-2.0.3/Mailman/Cgi/options.py
@@ -113,6 +113,11 @@
         'setdigest', 'Submit My Changes')
     replacements['<mm-unsubscribe-button>'] = (
         mlist.FormatButton('unsub', 'Unsubscribe'))
+    replacements['<mm-get-password-reminder-button>'] = mlist.FormatOptionButton(
+        mm_cfg.PasswordReminder, 1, user)
+    replacements['<mm-no-password-reminder-button>'] = mlist.FormatOptionButton(
+        mm_cfg.PasswordReminder, 0, user)
+
     replacements['<mm-digest-pw-box>'] = mlist.FormatSecureBox('digpw')
     replacements['<mm-unsub-pw-box>'] = mlist.FormatSecureBox('upw')
     replacements['<mm-old-pw-box>'] = mlist.FormatSecureBox('opw')
--- mailman-2.0.3.orig/Mailman/Cgi/handle_opts.py
+++ mailman-2.0.3/Mailman/Cgi/handle_opts.py
@@ -222,6 +222,7 @@
         dont_receive = getval('dontreceive',
                               useropt(user, mm_cfg.DontReceiveOwnPosts))
         ack_posts = getval('ackposts', useropt(user, mm_cfg.AcknowledgePosts))
+        remind_pass = getval('remindpass', useropt(user, mm_cfg.PasswordReminder))
         disable_mail = getval('disablemail',
                               useropt(user, mm_cfg.DisableDelivery))
         conceal = getval('conceal', useropt(user, mm_cfg.ConcealSubscription))
@@ -260,6 +261,7 @@
         mlist.SetUserOption(user, mm_cfg.DisableDelivery, disable_mail)
         mlist.SetUserOption(user, mm_cfg.DontReceiveOwnPosts, dont_receive)
         mlist.SetUserOption(user, mm_cfg.AcknowledgePosts, ack_posts)
+        mlist.SetUserOption(user, mm_cfg.PasswordReminder, remind_pass)
         mlist.SetUserOption(user, mm_cfg.DisableMime, mime)
         msg = 'You have successfully set your options.'
         try:
--- mailman-2.0.3.orig/Mailman/HTMLFormatter.py
+++ mailman-2.0.3/Mailman/HTMLFormatter.py
@@ -120,7 +120,8 @@
                 mm_cfg.DisableMime         : "mime",
                 mm_cfg.AcknowledgePosts    : "ackposts",
                 mm_cfg.Digests             : "digest",
-                mm_cfg.ConcealSubscription : "conceal"
+                mm_cfg.ConcealSubscription : "conceal",
+                mm_cfg.PasswordReminder    : "remindpass",
                 }[type]
 	import sys
 	return ('<input type=radio name="%s" value="%d"%s>'
--- mailman-2.0.3.orig/templates/options.html
+++ mailman-2.0.3/templates/options.html
@@ -139,6 +139,11 @@
 <MM-Hide-Subscription-Button> Yes <p>
 </td></tr>
 <tr><TD BGCOLOR="#dcdcdc">
+<strong> Get monthly password reminders? </strong><br>
+<MM-Get-Password-Reminder-Button> Yes
+<MM-No-Password-Reminder-Button> No <p>
+</td></tr>
+<tr><TD BGCOLOR="#dcdcdc">
 Password: <MM-Digest-Pw-Box>  <MM-Digest-Submit><p>
 </td></tr></table>
 </center>


-- 

Tollef Fog Heen
Unix _IS_ user friendly... It's just selective about who its friends are.