diff options
| author | bwarsaw | 2000-07-20 20:15:35 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-07-20 20:15:35 +0000 |
| commit | 2ee79f813f32fac5cb83e5b8c0052b706df21d2c (patch) | |
| tree | 064057b865fe96184ee42fbef3ec2b80c39ff4bc | |
| parent | a96b85b34990435673dd4ab772dd6eaad73decdc (diff) | |
| download | mailman-2ee79f813f32fac5cb83e5b8c0052b706df21d2c.tar.gz mailman-2ee79f813f32fac5cb83e5b8c0052b706df21d2c.tar.zst mailman-2ee79f813f32fac5cb83e5b8c0052b706df21d2c.zip | |
| -rw-r--r-- | Mailman/Cgi/admindb.py | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index d98a100e0..9bc9d7e62 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -27,6 +27,7 @@ from Mailman import Utils from Mailman import MailList from Mailman import Errors from Mailman import Message +from Mailman.Cgi import Auth from Mailman.htmlformat import * from Mailman.Logging.Syslog import syslog @@ -46,48 +47,6 @@ def handle_no_list(doc, extra=''): -def authenticated(mlist, cgidata): - # Returns 1 if the user is properly authenticated, otherwise it does - # everything necessary to put up a login screen and returns 0. - isauthed = 0 - adminpw = None - msg = '' - # - # If we get a password change request, we first authenticate by cookie - # here, and issue a new cookie later on iff the password change worked - # out. The idea is to set only one cookie when the admin password - # changes. The new cookie is necessary, because the checksum part of the - # cookie is based on (among other things) the list's admin password. - if cgidata.has_key('adminpw'): - adminpw = cgidata['adminpw'].value - # Attempt to authenticate - try: - isauthed = mlist.WebAuthenticate(password=adminpw, cookie='admin') - except Errors.MMExpiredCookieError: - msg = 'Stale cookie found' - except Errors.MMInvalidCookieError: - msg = 'Error decoding authorization cookie' - except (Errors.MMBadPasswordError, Errors.MMAuthenticationError): - msg = 'Authentication failed' - # - # Put up the login page if not authenticated - if not isauthed: - url = mlist.GetScriptURL('admindb', relative=1) - if msg: - msg = FontAttr(msg, color='#FF5060', size='+1').Format() - print 'Content-type: text/html\n' - print Utils.maketext( - # Should really be admlogin.html :/ - 'admlogin.txt', - {'listname': mlist.real_name, - 'path' : Utils.GetRequestURI(url), - 'message' : msg, - }) - return 0 - return 1 - - - def main(): doc = Document() # figure out which list we're going to process @@ -116,9 +75,10 @@ def main(): # selected actions try: cgidata = cgi.FieldStorage() - - # If the user id not authenticated, we're done. - if not authenticated(mlist, cgidata): + try: + Auth.authenticate(mlist, cgidata) + except Auth.NotLoggedInError, e: + Auth.loginpage(mlist, 'admindb', e.message) return # If this is a form submission, then we'll process the requests and |
