[Mailman-Users] Password reminder on private archive login page

liste yoneticisi listeyon at metu.edu.tr
Thu Jul 23 13:37:52 CEST 2009


Dear Mr. Sapiro;

Thank you very much for your quick response.

Few months ago we made a list based modification in our "test" list.

It can be seen here:
http://mailman.metu.edu.tr/mailman/private/test
-------------------------------------------------------------
I am not very good at object oriented programming, and can hardly
understand python
scripts.

But I am trying to understand the commands.
I tried the text in the attachment also but as you warned, it didn't
work.:-(

-----------------------------------
>The final problem is you've inserted your code in the wrong place. You
>put it where it is only reached if the user is already authenticated
>or provided a valid authentication.
-----------------------------------

Actually if someone reached to the archive (in order to see attachments,
messages for example) he probably had not logged into list archives
page yet. He is asked to enter his e-mail and corresponding password.

After submitting both correctly, the html form runs "private" script.
<FORM METHOD=POST  ACTION="$HOST/mailman/private/$LISTNAME"

But as you mentioned;
For the reminder form the necessary form action lines should be as
follows:

<FORM action="$HOST/mailman/options/$LISTNAME" method="POST" >
<INPUT name="email" type="TEXT"> (*)
<INPUT name="login-remind" type="SUBMIT" value="Remind" >

There are three submit buttons in options page but the necessary one is
named "login-remind".

(*) It may not be necessary, since it is already written in archive
authentication form. But the "private" script is reading the variables
"username and password", but "option" script is reading the
variable "email".

-----------------------
>What needs to be done is the reminder button has to be added to the
>private.html archive login template and code needs to be added to
>Mailman/Cgi/private.py to recognize the button and send the reminder.
-----------------------

You also suggested that a remind button could be added to
generic "private.html" externally.

I tried that also (but the Turkish version.
$MAILMAN_PATH/mailman/templates/tr/private.html)

But it didn't have any effect.


By the way;
from the file  "Mailman/Cgi/options.py"
I copied the necessary lines as follows.

    # Password reminder section
    actionurl = mlist.GetScriptURL('options')

    form = Form(actionurl)
    table = Table(width='100%', border=0, cellspacing=4, cellpadding=5)

    table.AddRow([Center(Header(2, _('Password reminder')))])

    table.AddCellInfo(table.GetCurrentRowIndex(), 0,
                      bgcolor=mm_cfg.WEB_HEADER_COLOR)

    table.AddRow([Label(_('Email address:')),
                       TextBox('email', size=20)])

    table.AddRow([_("""By clicking on the <em>Remind</em> button, your
    password will be emailed to you.""")])

    table.AddRow([Center(SubmitButton('login-remind', _('Remind')))])
    # Finish up glomming together the login page

-------------
Do these lines work?
Is it necessary to add html code to template/private.html also?

Regards...
----------------
Liste Yoneticisi
http://e-list.cc.metu.edu.tr
http://e-liste.bidb.odtu.edu.tr

On Mon, 20 Jul 2009, Mark Sapiro wrote:

Date: Mon, 20 Jul 2009 20:20:22 -0700
From: Mark Sapiro <mark at msapiro.net>
To: liste yoneticisi <listeyon at metu.edu.tr>,
     Mailman Users ML <mailman-users at python.org>
Subject: Re: [Mailman-Users] Password reminder on private archive login page

liste yoneticisi wrote:
>
>I have two main questions.
>
>First; We once asked about adding password reminder to private archive
>login page. We tried some modifications but couldn't succeed. I copied the
>previous correspondence below.
>
>"""
>>Can I put the password reminder on private archive login page? So that,
>>list members who want to see the archive, but do not remember their
>>passwords, can quickly learn their passwords. Otherwise, password
>>reminder is too hard to find using the links on general list info page..
>
>
>This is a good idea. I think I'll implement it for Mailman 2.2.
>
>What needs to be done is the reminder button has to be added to the
>private.html archive login template and code needs to be added to
>Mailman/Cgi/private.py to recognize the button and send the reminder.
>
>You can look at Mailman/Cgi/options.py for how it's done there.
>"""
>
>
>I have added the following lines to
>PATH/mailman/Mailman/Cgi/private.py
>
>"
>        print Utils.maketext(
>            'private.html',
>            {'action'  : Utils.websafe(action),
>             'realname': mlist.real_name,
>             'message' : message,
>             }, mlist=mlist)
>        return
>
>### My Lines 7/4/2009 Eklenti baslangic
>
>    if cgidata.has_key('emailpw'):
>        mlist.MailUserPassword(user)
>        options_page(
>            mlist, doc, user, cpuser, userlang,
>            _('A reminder of your password has been emailed to you.'))
>        print doc.Format()
>        return
>### My Lines 7/4/2009 Eklenti bitis
>
>
>    lang = mlist.getMemberLanguage(username)
>    i18n.set_language(lang)
>    doc.set_language(lang)
>
>    # Authorization confirmed... output the desired file
>    try:
>        ctype, enc = guess_type(path, strict=0)
>
>"
>
>But nothing changed.:-(


There are several things wrong with the above.

You have copied the wrong code from options.py. That code processes the
reminder button from the logged-in options page (I'm not sure why
there is a reminder there, but the list admin could use it to send a
reminder to the user). You want the code that follows the comment

    # Are we processing a password reminder from the login screen?

but if you copy it verbatim as you did with the other, you'll have the
problem that it calls the function loginpage() just as the above calls
options_page() and those functions are local to the options.py module
and undefined in private.py. You don't want to call either of those.

The final problem is you've inserted your code in the wrong place. You
put it where it is only reached if the user is already authenticated
or provided a valid authentication.


More information about the Mailman-Users mailing list