diff MoinMoin/action/newaccount.py @ 2365:b9feee61d28e

split newaccount form from prefs
author Johannes Berg <johannes AT sipsolutions DOT net>
date Thu, 12 Jul 2007 11:40:04 +0200
parents 22749e92a461
children 58260d360f5c
line wrap: on
line diff
--- a/MoinMoin/action/newaccount.py	Thu Jul 12 11:39:35 2007 +0200
+++ b/MoinMoin/action/newaccount.py	Thu Jul 12 11:40:04 2007 +0200
@@ -10,7 +10,6 @@
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 import MoinMoin.events as events
-from MoinMoin.userprefs.prefs import Settings
 
 
 _debug = False
@@ -90,6 +89,59 @@
     return result
 
 
+def _create_form(request):
+    _ = request.getText
+    url = request.page.url(request)
+    ret = html.FORM(action=url)
+    ret.append(html.INPUT(type='hidden', name='action', value='newaccount'))
+    lang_attr = request.theme.ui_lang_attr()
+    ret.append(html.Raw('<div class="userpref"%s>' % lang_attr))
+    tbl = html.TABLE(border="0")
+    ret.append(tbl)
+    ret.append(html.Raw('</div>'))
+
+    row = html.TR()
+    tbl.append(row)
+    row.append(html.TD().append(html.STRONG().append(
+                                  html.Text(_("Name")))))
+    row.append(html.TD().append(html.INPUT(type="text", size="36",
+                                           name="name")))
+
+    row = html.TR()
+    tbl.append(row)
+    row.append(html.TD().append(html.STRONG().append(
+                                  html.Text(_("Password")))))
+    row.append(html.TD().append(html.INPUT(type="password", size="36",
+                                           name="password")))
+
+    row = html.TR()
+    tbl.append(row)
+    row.append(html.TD().append(html.STRONG().append(
+                                  html.Text(_("Password repeat")))))
+    row.append(html.TD().append(html.INPUT(type="password", size="36",
+                                           name="password2")))
+
+    row = html.TR()
+    tbl.append(row)
+    row.append(html.TD().append(html.STRONG().append(html.Text(_("Email")))))
+    row.append(html.TD().append(html.INPUT(type="text", size="36",
+                                           name="email")))
+
+    row = html.TR()
+    tbl.append(row)
+    row.append(html.TD())
+    td = html.TD()
+    row.append(td)
+    td.append(html.INPUT(type="submit", name="create_only",
+                         value=_('Create Profile')))
+    if request.cfg.mail_enabled:
+        td.append(html.Text(' '))
+        td.append(html.INPUT(type="submit", name="create_and_mail",
+                             value="%s + %s" % (_('Create Profile'),
+                                                _('Email'))))
+
+    return unicode(ret)
+
 def execute(pagename, request):
     pagename = pagename
     page = Page(request, pagename)
@@ -108,7 +160,7 @@
         request.write(request.formatter.startContent("content"))
 
         # THIS IS A BIG HACK. IT NEEDS TO BE CLEANED UP
-        request.write(Settings(request).create_form(create_only=True))
+        request.write(_create_form(request))
 
         request.write(request.formatter.endContent())