Attachment 'moin1-5-4-1userform.diff'

Download

   1 --- userform_orig.py	2006-04-25 01:19:00.000000000 +0200
   2 +++ userform.py	2006-11-25 16:42:46.000000000 +0100
   3 @@ -154,9 +154,12 @@
   4              # save data
   5              theuser.save()
   6              if form.has_key('create_and_mail'):
   7 -                theuser.mailAccountData()
   8 -            
   9 -            result = _("User account created! You can use this account to login now...")
  10 +                result1 = _("User account created.") # ToDo: Add translation for this!!
  11 +                result2 = theuser.mailAccountData(form.get('password', [''])[0],True)
  12 +                result = "%s %s" % (result1, _(result2)) # This assumes that all msg from mailAccountData have translations
  13 +            else:
  14 +                result = _("User account created! You can use this account to login now...")
  15 +
  16              if _debug:
  17                  result = result + util.dumpFormData(form)
  18              return result
  19 @@ -477,7 +480,7 @@
  20          _ = self._
  21          self.make_form()
  22  
  23 -        if self.request.user.isSuperUser():
  24 +        if self.request.user.isSuperUser() and create_only == False:
  25              ticket = wikiutil.createTicket()
  26              self.make_row(_('Select User'), [self._user_select()])
  27              self._form.append(html.INPUT(type="hidden", name="ticket", value="%s" % ticket))
  28 @@ -588,22 +591,50 @@
  29                  ('create', _('Create Profile')),
  30                  ('cancel', _('Cancel')),
  31              ]
  32 -            for key, label, type, length, textafter in self.cfg.user_form_fields:
  33 -                if key in ('name', 'password', 'password2', 'email'):
  34 -                    self.make_row(_(label),
  35 -                              [ html.INPUT(type=type, size=length, name=key,
  36 -                                           value=''),
  37 -                                ' ', _(textafter), ])
  38 +            if create_only == False:
  39 +                for key, label, type, length, textafter in self.cfg.user_form_fields:
  40 +                    if key in ('name', 'password', 'password2', 'email'):
  41 +                        self.make_row(_(label),
  42 +                                  [ html.INPUT(type=type, size=length, name=key,
  43 +                                               value=''),
  44 +                                    ' ', _(textafter), ])
  45 +            else:
  46 +                # We are in invitation mode; create some dummy password
  47 +                from random import choice
  48 +                letters = "abcdefghijklmnopqrstuvwxyz"
  49 +                letters += "0123456789"
  50 +                pwd = ''
  51 +                for i in range(6):
  52 +                    pwd += choice(letters)
  53 +                    
  54 +                for key, label, type, length, textafter in self.cfg.user_form_fields:
  55 +                    if key in ('name', 'password', 'password2', 'email'):
  56 +                        
  57 +                        if key == 'password' or key == 'password2':
  58 +                            self.make_row(_(label),
  59 +                                      [ html.INPUT(type=type, size=length, name=key,
  60 +                                                   value='%s' % pwd),
  61 +                                        ' ', _(textafter), ])
  62 +                        else:
  63 +                            self.make_row(_(label),
  64 +                                  [ html.INPUT(type=type, size=length, name=key,
  65 +                                               value=''),
  66 +                                    ' ', _(textafter), ])
  67 +            
  68  
  69          if self.cfg.mail_enabled:
  70              buttons.append(("account_sendmail", _('Mail me my account data')))
  71  
  72          if create_only:
  73 -            buttons = [("create_only", _('Create Profile'))]
  74 +            # We don't want to have a create profile button in invitation mode
  75 +            #buttons = [("create_only", _('Create Profile'))]
  76 +            buttons = []
  77              if self.cfg.mail_enabled:
  78                  buttons.append(("create_and_mail", "%s + %s" %
  79                                  (_('Create Profile'), _('Email'))))
  80  
  81 +            buttons.append(('cancel', _('Cancel')))
  82 +
  83          # Add buttons
  84          button_cell = []
  85          for name, label in buttons:

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-11-25 20:10:35, 1.4 KB) [[attachment:MakeInvitation.py]]
  • [get | view] (2006-12-10 22:20:31, 1.1 KB) [[attachment:MakeInvitation.txt]]
  • [get | view] (2006-12-10 22:20:06, 2.8 KB) [[attachment:MakeInvitation1-6-dev.py]]
  • [get | view] (2008-11-20 08:40:46, 9.3 KB) [[attachment:MakeInvitation_v1.7.2.gif]]
  • [get | view] (2008-11-20 07:33:50, 3.0 KB) [[attachment:MakeInvitation_v1.7.2.py]]
  • [get | view] (2008-11-20 07:34:07, 1.2 KB) [[attachment:MakeInvitation_v1.7.2.txt]]
  • [get | view] (2006-12-10 22:19:33, 2.5 KB) [[attachment:mailAccountData.py]]
  • [get | view] (2006-11-25 20:10:53, 2.3 KB) [[attachment:moin1-5-4-1user.diff]]
  • [get | view] (2006-11-25 20:13:16, 4.1 KB) [[attachment:moin1-5-4-1userform.diff]]
  • [get | view] (2006-12-10 22:19:03, 2.2 KB) [[attachment:user-1-6-dev.diff]]
  • [get | view] (2006-11-25 20:12:10, 33.3 KB) [[attachment:user_moin1-5-4-1_patched.py]]
  • [get | view] (2006-12-10 22:18:31, 1.0 KB) [[attachment:userform.diff]]
  • [get | view] (2006-11-25 20:12:52, 31.5 KB) [[attachment:userform_moin1-5-4-1_patched.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.