3 # Copyright (C) 2004-2007 by the Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # Inspired by Florian Weimer.
21 """Reset the passwords for members of a mailing list.
23 This script resets all the passwords of a mailing list's members. It can also
24 be used to reset the lists of all members of all mailing lists, but it is your
25 responsibility to let the users know that their passwords have been changed.
27 This script is intended to be run as a bin/withlist script, i.e.
29 % bin/withlist -l -r reset_pw listname [options]
33 Print what the script is doing.
40 from Mailman
import Utils
41 from Mailman
.i18n
import _
45 def usage(code
, msg
=''):
50 print >> fd
, _(__doc__
.replace('%', '%%'))
57 def reset_pw(mlist
, *args
):
59 opts
, args
= getopt
.getopt(args
, 'v', ['verbose'])
60 except getopt
.error
, msg
:
64 for opt
, args
in opts
:
65 if opt
in ('-v', '--verbose'):
68 listname
= mlist
.internal_name()
70 print _('Changing passwords for list: %(listname)s')
72 for member
in mlist
.getMembers():
73 randompw
= Utils
.MakeRandomPassword()
74 mlist
.setMemberPassword(member
, randompw
)
76 print _('New password for member %(member)40s: %(randompw)s')
82 if __name__
== '__main__':