Short description Sometimes if you don't want new user creations you could remove the page where that macro is called from by acls. (Users in a group defined could be able to read this page but All not.) Unfortunately on the same form is the Mail me my account data form. So an user who forgets his password and is not logged in can't get it sended.

So this feature request is about adding a second page with this [[SendAccounMail]] macro -- ReimarBauer 2006-08-19 11:26:32

   1 --- /usr/lib/python2.3/site-packages/MoinMoin-1.5.4/userform.py	2006-06-22 20:57:23.000000000 +0200
   2 +++ userform.py	2006-08-19 13:13:20.966590696 +0200
   3  
   4 @@ -649,8 +649,11 @@
   5          pi = request.getPathinfo()
   6          action = u"%s%s" % (sn, pi)
   7          userprefslink = wikiutil.getSysPage(request, "UserPreferences").link_to(request)
   8 -        hint = _("To create an account or recover a lost password, see the %(userprefslink)s page.") % {
   9 -               'userprefslink': userprefslink}
  10 +        sendmypasswordlink = wikiutil.getSysPage(request, "SendMyPassword").link_to(request)
  11 +        
  12 +        hint = _("To create an account or recover a lost password, see the %(userprefslink)s page. Or if you like to get sent your password go to %(SendMyPassword)s.") % {
  13 +               'userprefslink': userprefslink,
  14 +               'SendMyPassword':sendmypasswordlink}
  15          self._form = html.FORM(action=action)
  16          self._table = html.TABLE(border="0")
  17  
userform.patch.txt

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - SendAccountMail form
   4     
   5     Syntax:
   6        [[SendAccountMail]]
   7 
   8     @copyright: 2006 by Reimar Bauer
   9     @license: GNU GPL, see COPYING for details.
  10 """
  11 
  12 def execute(macro, args):
  13     return '''
  14 <form action="UserPreferences" method="POST">
  15 <div class="userpref" lang="de" dir="ltr">
  16 <input type="hidden" name="action" value="userform">
  17 <table border="0"><tr><td><b>E-Mail</b>   </td><td><input type="text" name="email" value="" size="36"> </td></tr>
  18 <tr><td><b></b>   </td><td> <input type="submit" name="account_sendmail" value="Mail me my account data"> </td></tr></table></form>'''
SendAccountMail-1.5.py

Moin 1.6dev

Did some changes to SendAccountMail.py to make it 1.6dev compatible (moin-1-6-main-7c58e8af1a97). -- OliverSiemoneit 2006-12-10 16:20:34

   1 --- userform_old.py	2006-12-09 13:32:00.000000000 +0100
   2 +++ userform.py	2006-12-10 18:13:18.000000000 +0100
   3 @@ -638,8 +638,10 @@
   4          pi = request.getPathinfo()
   5          action = u"%s%s" % (sn, pi)
   6          userprefslink = wikiutil.getSysPage(request, "UserPreferences").link_to(request, rel='nofollow')
   7 -        hint = _("To create an account or recover a lost password, see the %(userprefslink)s page.") % {
   8 -               'userprefslink': userprefslink}
   9 +        sendmypasswordlink = wikiutil.getSysPage(request, "SendMyPassword").link_to(request, rel='nofollow')
  10 +        hint = _("To create an account, see the %(userprefslink)s page. To recover a lost password, go to %(sendmypasswordlink)s.") % {
  11 +               'userprefslink': userprefslink,
  12 +               'sendmypasswordlink': sendmypasswordlink}
  13          self._form = html.FORM(action=action)
  14          self._table = html.TABLE(border="0")
  15  
userform1-6-dev.diff

... and here the new underlay page SendMyPassword

   1 ## Please edit system and help pages ONLY in the moinmaster wiki! For more
   2 ## information, please see MoinMaster:MoinPagesEditorGroup.
   3 ##master-page:Unknown-Page
   4 ##master-date:Unknown-Date
   5 #acl MoinPagesEditorGroup:read,write,delete,revert All:read
   6 #format wiki
   7 #language en
   8 [[SendAccountMail]]
   9 
  10 == Recovering a lost password ==
  11 
  12 If you have forgotten your password, provide your email address and click on '''[[GetText(Mail me my account data)]]'''.
  13 
  14 The email you get contains the encrypted password (so even if someone intercepts the mail, he won't know your REAL password). Just copy and paste it into the login mask into the password field and log in.
  15 
  16 Then change your password to a known value and save your settings.
SendMyPassword.txt

updated version -- ReimarBauer 2007-01-06 18:30:00

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - SendAccountMail form
   4     
   5     Syntax:
   6        [[SendAccountMail]]
   7 
   8     @copyright: 2006 by Reimar Bauer, Oliver Siemoneit
   9     @license: GNU GPL, see COPYING for details.
  10 """
  11 
  12 from MoinMoin.widget import html
  13 
  14 
  15 def make_row(table, label, cell, **kw):
  16     """ Create a row in the form table.
  17     """
  18     table.append(html.TR().extend([
  19         html.TD(**kw).extend([html.B().append(label), '   ']),
  20         html.TD().extend(cell),
  21     ]))
  22     return table
  23 
  24 def execute(macro, args):
  25     request = macro.request
  26     _ = request.getText
  27     formatter = macro.formatter
  28 
  29     sn = request.getScriptname()
  30     pi = request.getPathinfo()
  31     action = u"%s%s" % (sn, pi)
  32     form = html.FORM(action=action)
  33     table = html.TABLE(border="0")
  34 
  35     if not request.cfg.mail_enabled:
  36         return _("This wiki is not enabled for mail processing.\nContact the owner of the wiki, who can enable email.")
  37     else:
  38         buttons = []
  39         action = u"%s%s" % (sn, pi)
  40         form = html.FORM(action=action)
  41         table = html.TABLE(border="0")
  42 
  43         # Add form fields
  44         for key, label, type, length, textafter in request.cfg.user_form_fields:
  45             if key == 'email':
  46                 table = make_row(table, _(label),
  47                                  [html.INPUT(type=type, size=length, name=key,
  48                                  value=''), ' ', ])
  49         # Add buttons
  50         buttons.append(("account_sendmail", _('Mail me my account data')))
  51         button_cell = []
  52         for name, label in buttons:
  53             if not name in request.cfg.user_form_remove:
  54                 button_cell.extend([
  55                      html.INPUT(type="submit", name=name, value=label),
  56                      ' ',
  57                 ])
  58         make_row(table, '', button_cell)
  59 
  60         # Use the user interface language and direction
  61         lang_attr = request.theme.ui_lang_attr()
  62         form.append(html.Raw('<div class="userprefs"%s>' % lang_attr))
  63         form.append(html.INPUT(type="hidden", name="action", value="userform"))
  64         form.append(table)
  65         form.append(html.Raw("</div>"))
  66 
  67         return unicode(form)
SendAccountMail-1.6-dev-2.py

For "correct" display (i.e. if you don't like a visible table) the div-class in line 62 should be "userpref" and not "userprefs". That's the bug you'd helped me to find, remember? This is also "wrong" in userform.py, line 651, and my related patches for a separate CreateAccountPage underlay page and CreateAccount macro and for the MakeInvitations patch. -- OliverSiemoneit 2007-01-06 19:27:37

slightly different implemented into the macro Login. -- ReimarBauer 2007-01-07 10:23:53


CategoryFeatureImplemented

MoinMoin: FeatureRequests/LoginHintToSendPasswordonlyWithoutUserCreation (last edited 2007-10-29 19:16:30 by localhost)