Short description

For unexperienced users it is very irritaing when on the page where the account creation should take place information and buttons are given which are not relevant for creation process of the account. There is no need to have e.g. a "Mail me my account data" on an account creation page. This puzzles users. It is also not needed to explain them how to change settings with the "Save account data" button, how to reset a password and so on.. So this feature request is about having a separate underlay page "CreateAccount" which gives only the advice really needed and a new macro to perform the account creation.

Patch for moin-1-6-main-7c58e8af1a97

Here is the new underlay page "CreateAccount".

   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 [[CreateAccount]]
   9 
  10 == Create a new account ==
  11 Please fill out '''[[GetText(Name)]]''', '''[[GetText(Password)]]''', '''[[GetText(Password repeat)]]''' and '''[[GetText(Email)]]'''.
  12 
  13 (!) It is best to choose a WikiName (like Firstname``Lastname) as username to get your changes and signatures link back to your Wiki``Homepage. Your email is needed for you to be able to get notifications on page changes and to recover lost login data.
  14 
  15 If you click on '''[[GetText(Create Profile)]]''', a user profile will be created for you and you will be logged in immediately.
CreateAccount.txt

To get this work correctly you do also need a new macro which does simply create a login form but leaves the event handling still to userpreferences.

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - CreateAccount Macro
   4 
   5     Syntax:
   6         [[CreateAccount]]
   7 
   8     Lot of code take from userform.py
   9     MoinMoin - userform.py
  10     @copyright: 2001-2004 by Jürgen Hermann <jh@web.de>
  11     @license: GNU GPL, see COPYING for details.
  12     
  13     MoinMoin - CreateAccount Macro
  14     @copyright: 2006 by Oliver Siemoneit
  15     @license: GNU GPL, see COPYING for details.
  16 """
  17 
  18 from MoinMoin.widget import html
  19 
  20 
  21 def make_row(table, label, cell, **kw):
  22     """ Create a row in the form table.
  23     """
  24     table.append(html.TR().extend([
  25         html.TD(**kw).extend([html.B().append(label), '   ']),
  26         html.TD().extend(cell),
  27     ]))
  28     return table
  29 
  30 def execute(macro, args):
  31     request = macro.request
  32     _ = request.getText
  33     formatter = macro.formatter
  34 
  35     # Check if user is logged in
  36     if request.user.name != "":
  37         return ''
  38 
  39     sn = request.getScriptname()
  40     pi = request.getPathinfo()
  41     action = u"%s%s" % (sn, pi)
  42     form = html.FORM(action=action)
  43     table = html.TABLE(border="0")
  44 
  45     # Add form fields
  46     for key, label, type, length, textafter in request.cfg.user_form_fields:
  47         if key in ('name', 'password', 'password2', 'email'):
  48             if key == 'password2':
  49                 table = make_row(table, _(label),
  50                                   [html.INPUT(type=type, size=length, name=key,
  51                                               value=''),
  52                                    ' ', ])
  53                
  54             else:
  55                 table = make_row(table, _(label),
  56                                   [html.INPUT(type=type, size=length, name=key,
  57                                               value=''),
  58                                    ' ', _(textafter), ])
  59     # Add buttons
  60     buttons = [ ('create', _('Create Profile')),
  61                 ('cancel', _('Cancel')),
  62     ]
  63 
  64     button_cell = []
  65     for name, label in buttons:
  66         if not name in request.cfg.user_form_remove:
  67             button_cell.extend([
  68                 html.INPUT(type="submit", name=name, value=label),
  69                 ' ',
  70             ])
  71     make_row(table,'', button_cell)
  72 
  73 
  74     # Use the user interface language and direction
  75     lang_attr = request.theme.ui_lang_attr()
  76     form.append(html.Raw('<div class="userprefs"%s>' % lang_attr))
  77     form.append(html.INPUT(type="hidden", name="action", value="userform"))
  78     form.append(table)
  79     form.append(html.Raw("</div>"))
  80    
  81     return unicode(form)
CreateAccount.py

Discussion

This patch works nicely together with the given patch for a separate underlay page "SendMyPassword" on FeatureRequests/LoginHintToSendPasswordonlyWithoutUserCreation. You can use these to patches to restyle your log in as follows:

screenshot.jpg

To get both patches work nicely together, you have to apply the following changes to userform.py:

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

This patch for a separate CreateAccount page works also nicely together with some redirect feature built in in the patch of FeatureRequests/WelcomeNewUserPage. I would suggest to add the following changes to action/_init_.py (not yet tested, should work "theoretically"..)

   1 --- __init__old.py	2006-12-09 13:32:00.000000000 +0100
   2 +++ __init__.py	2006-12-10 21:41:18.000000000 +0100
   3 @@ -276,9 +276,17 @@
   4  
   5  def do_userform(pagename, request):
   6      """ save data posted from UserPreferences """
   7 +    _ = request.getText
   8      from MoinMoin import userform
   9      savemsg = userform.savedata(request)
  10 -    Page(request, pagename).send_page(request, msg=savemsg)
  11 +    if (savemsg == _("User account created! You can use this account to login now...")) and (request.cfg.show_welcome == True):
  12 +        welcomeuserpage = wikiutil.getSysPage(request, "WelcomeUser")
  13 +        request.http_redirect(welcomeuserpage.url(request, escape=0, relative=False))
  14 +    elif savemsg == _("User account created! You can use this account to login now..."):
  15 +        userprefspage = wikiutil.getSysPage(request, "UserPreferences")
  16 +        request.http_redirect(userprefspage.url(request, escape=0, relative=False))
  17 +    else:
  18 +        Page(request, pagename).send_page(request, msg=savemsg)
  19  
  20  # Dispatching ----------------------------------------------------------------
  21  def getNames(cfg):
action_init_.diff

So after successfull account creation and automatic log in (this is still missing but will be there in 1.6) the new redirect feature will take you either to the useprefs page (default) or to some welcome new user screen (if show_welcome = True is set in wikiconfig.py). Without this redirect feature the separate CreateAccount page loses some of its power and is not that nice and neat to use.

That's it! -- OliverSiemoneit 2006-12-10 20:49:28


CategoryFeaturePatched

MoinMoin: FeatureRequests/SeparateCreateAccountPage (last edited 2007-10-29 19:06:59 by localhost)