# Copyright (C) 1998-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
Important: From this point on, you must have
cookies enabled in your browser, otherwise none of your changes will take
effect.
""")])
# Password and login button
ptable = Table(width='50%', border=0, cellspacing=4, cellpadding=5)
if user is None:
ptable.AddRow([Label(_('Email address:')),
TextBox('email', size=20)])
else:
ptable.AddRow([Hidden('email', user)])
ptable.AddRow([Label(_('Password:')),
PasswordBox('password', size=20)])
ptable.AddRow([Center(SubmitButton('login', _('Log in')))])
ptable.AddCellInfo(ptable.GetCurrentRowIndex(), 0, colspan=2)
table.AddRow([Center(ptable)])
# Unsubscribe section
table.AddRow([Center(Header(2, _('Unsubscribe')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
bgcolor=config.WEB_HEADER_COLOR)
table.AddRow([_("""By clicking on the Unsubscribe button, a
confirmation message will be emailed to you. This message will have a
link that you should click on to complete the removal process (you can
also confirm by email; see the instructions in the confirmation
message).""")])
table.AddRow([Center(SubmitButton('login-unsub', _('Unsubscribe')))])
# Password reminder section
table.AddRow([Center(Header(2, _('Password reminder')))])
table.AddCellInfo(table.GetCurrentRowIndex(), 0,
bgcolor=config.WEB_HEADER_COLOR)
table.AddRow([_("""By clicking on the Remind button, your
password will be emailed to you.""")])
table.AddRow([Center(SubmitButton('login-remind', _('Remind')))])
# Finish up glomming together the login page
form.AddItem(table)
doc.AddItem(form)
doc.AddItem(mlist.GetMailmanFooter())
def lists_of_member(mlist, user):
hostname = mlist.host_name
onlists = []
for listname in config.list_manager.names:
# The current list will always handle things in the mainline
if listname == mlist.internal_name():
continue
glist = MailList.MailList(listname, lock=0)
if glist.host_name <> hostname:
continue
if not glist.isMember(user):
continue
onlists.append(glist)
return onlists
def change_password(mlist, user, newpw):
# Must own the list lock!
mlist.Lock()
try:
# Change the user's password. The password must already have been
# compared to the confirmpw and otherwise been vetted for
# acceptability.
mlist.setMemberPassword(user, newpw)
mlist.Save()
finally:
mlist.Unlock()
def global_options(mlist, user, globalopts):
# Is there anything to do?
for attr in dir(globalopts):
if attr.startswith('_'):
continue
if getattr(globalopts, attr) is not None:
break
else:
return
def sigterm_handler(signum, frame, mlist=mlist):
# Make sure the list gets unlocked...
mlist.Unlock()
# ...and ensure we exit, otherwise race conditions could cause us to
# enter MailList.Save() while we're in the unlocked state, and that
# could be bad!
sys.exit(0)
# Must own the list lock!
mlist.Lock()
try:
if globalopts.enable is not None:
mlist.setDeliveryStatus(user, globalopts.enable)
if globalopts.remind is not None:
mlist.setMemberOption(user, config.SuppressPasswordReminder,
globalopts.remind)
if globalopts.nodupes is not None:
mlist.setMemberOption(user, config.DontReceiveDuplicates,
globalopts.nodupes)
if globalopts.mime is not None:
mlist.setMemberOption(user, config.DisableMime, globalopts.mime)
mlist.Save()
finally:
mlist.Unlock()
def topic_details(mlist, doc, user, cpuser, userlang, varhelp):
# Find out which topic the user wants to get details of
reflist = varhelp.split('/')
name = None
topicname = _('' + Utils.websafe(OR.join(pattern.splitlines()))
+ ''])
table.AddRow([Bold(Label(_('Description:'))),
Utils.websafe(description)])
# Make colors look nice
for row in range(1, 4):
table.AddCellInfo(row, 0, bgcolor=config.WEB_ADMINITEM_COLOR)
options_page(mlist, doc, user, cpuser, userlang, table.Format())
print doc.Format()