Important: From this point on, you must have + cookies enabled in your browser, otherwise none of your changes will take + effect. + +
Session cookies are used in Mailman's membership options interface so + that you don't need to re-authenticate with every operation. This cookie + will expire automatically when you exit your browser, or you can + explicitly expire the cookie by hitting the Logout link (which + you'll see once you successfully log in). + """)]) + # Password and login button + ptable = Table(width='50%', border=0, cellspacing=4, cellpadding=5) + 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, but only if the user didn't just unsubscribe + if not cgidata.has_key('login-unsub'): + table.AddRow([Center(Header(2, _('Unsubscribe')))]) + table.AddCellInfo(table.GetCurrentRowIndex(), 0, + bgcolor=mm_cfg.WEB_HEADERCOLOR) + + 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, but only if the user didn't just request a + # password reminder + if not cgidata.has_key('login-remind'): + table.AddRow([Center(Header(2, _('Password reminder')))]) + table.AddCellInfo(table.GetCurrentRowIndex(), 0, + bgcolor=mm_cfg.WEB_HEADERCOLOR) + + 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 add_error_message(doc, errmsg, tag='Warning: ', *args): + doc.AddItem(Header(3, Bold(FontAttr( + _(tag), color="#ff0000", size="+2")).Format() + + Italic(errmsg % args).Format())) + + + +def lists_of_member(hostname, user): + onlists = [] + for listname in Utils.list_names(): + mlist = MailList.MailList(listname, lock=0) + if mlist.host_name <> hostname: + continue + if not mlist.IsMember(user): + continue + onlists.append(mlist) + return onlists + + + +def change_password(mlist, user, newpw, confirmpw): + # This operation requires the list lock, so let's set up the signal + # handling so the list lock will get released when the user hits the + # browser stop button. + 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: + # Install the emergency shutdown signal handler + signal.signal(signal.SIGTERM, sigterm_handler) + # change the user's password + mlist.ChangeUserPassword(user, newpw, confirmpw) + mlist.Save() + finally: + mlist.Unlock() + + + +def global_options(mlist, user, global_enable, global_remind): + 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: + # Install the emergency shutdown signal handler + signal.signal(signal.SIGTERM, sigterm_handler) + + if global_enable is not None: + mlist.SetUserOption(user, mm_cfg.DisableDelivery, global_enable) + + if global_remind is not None: + mlist.SetUserOption(user, mm_cfg.SuppressPasswordReminder, + global_remind) + + mlist.Save() + finally: + mlist.Unlock() -- cgit v1.2.3-70-g09d2