summaryrefslogtreecommitdiff
path: root/src/mailman/commands/cmd_password.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-03-29 15:40:22 -0500
committerBarry Warsaw2009-03-29 15:40:22 -0500
commit5388a2358749a1774bb801e6e6839c1798998a1f (patch)
tree6bf6f2a10f1f1f588d5ca6d2f4c8ec8e6530cb4a /src/mailman/commands/cmd_password.py
parentf90c651d85050b9ad3b33bdf210672452d2ba1f0 (diff)
downloadmailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.gz
mailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.zst
mailman-5388a2358749a1774bb801e6e6839c1798998a1f.zip
Diffstat (limited to 'src/mailman/commands/cmd_password.py')
-rw-r--r--src/mailman/commands/cmd_password.py123
1 files changed, 0 insertions, 123 deletions
diff --git a/src/mailman/commands/cmd_password.py b/src/mailman/commands/cmd_password.py
deleted file mode 100644
index 545da0cb5..000000000
--- a/src/mailman/commands/cmd_password.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# Copyright (C) 2002-2009 by the Free Software Foundation, Inc.
-#
-# This file is part of GNU Mailman.
-#
-# GNU Mailman is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
-
-"""
- password [<oldpassword> <newpassword>] [address=<address>]
- Retrieve or change your password. With no arguments, this returns
- your current password. With arguments <oldpassword> and <newpassword>
- you can change your password.
-
- If you're posting from an address other than your membership address,
- specify your membership address with `address=<address>' (no brackets
- around the email address, and no quotes!). Note that in this case the
- response is always sent to the subscribed address.
-"""
-
-from email.Utils import parseaddr
-
-from mailman.config import config
-from mailman.i18n import _
-
-STOP = 1
-
-
-
-def gethelp(mlist):
- return _(__doc__)
-
-
-
-def process(res, args):
- mlist = res.mlist
- address = None
- if not args:
- # They just want to get their existing password
- realname, address = parseaddr(res.msg['from'])
- if mlist.isMember(address):
- password = mlist.getMemberPassword(address)
- res.results.append(_('Your password is: %(password)s'))
- # Prohibit multiple password retrievals.
- return STOP
- else:
- listname = mlist.real_name
- res.results.append(
- _('You are not a member of the %(listname)s mailing list'))
- return STOP
- elif len(args) == 1 and args[0].startswith('address='):
- # They want their password, but they're posting from a different
- # address. We /must/ return the password to the subscribed address.
- address = args[0][8:]
- res.returnaddr = address
- if mlist.isMember(address):
- password = mlist.getMemberPassword(address)
- res.results.append(_('Your password is: %(password)s'))
- # Prohibit multiple password retrievals.
- return STOP
- else:
- listname = mlist.real_name
- res.results.append(
- _('You are not a member of the %(listname)s mailing list'))
- return STOP
- elif len(args) == 2:
- # They are changing their password
- oldpasswd = args[0]
- newpasswd = args[1]
- realname, address = parseaddr(res.msg['from'])
- if mlist.isMember(address):
- if mlist.Authenticate((config.AuthUser, config.AuthListAdmin),
- oldpasswd, address):
- mlist.setMemberPassword(address, newpasswd)
- res.results.append(_('Password successfully changed.'))
- else:
- res.results.append(_("""\
-You did not give the correct old password, so your password has not been
-changed. Use the no argument version of the password command to retrieve your
-current password, then try again."""))
- res.results.append(_('\nUsage:'))
- res.results.append(gethelp(mlist))
- return STOP
- else:
- listname = mlist.real_name
- res.results.append(
- _('You are not a member of the %(listname)s mailing list'))
- return STOP
- elif len(args) == 3 and args[2].startswith('address='):
- # They want to change their password, and they're sending this from a
- # different address than what they're subscribed with. Be sure the
- # response goes to the subscribed address.
- oldpasswd = args[0]
- newpasswd = args[1]
- address = args[2][8:]
- res.returnaddr = address
- if mlist.isMember(address):
- if mlist.Authenticate((config.AuthUser, config.AuthListAdmin),
- oldpasswd, address):
- mlist.setMemberPassword(address, newpasswd)
- res.results.append(_('Password successfully changed.'))
- else:
- res.results.append(_("""\
-You did not give the correct old password, so your password has not been
-changed. Use the no argument version of the password command to retrieve your
-current password, then try again."""))
- res.results.append(_('\nUsage:'))
- res.results.append(gethelp(mlist))
- return STOP
- else:
- listname = mlist.real_name
- res.results.append(
- _('You are not a member of the %(listname)s mailing list'))
- return STOP