浏览代码

allow to set user name which will be visible in the interface

Damien Accorsi 11 年前
父节点
当前提交
98e5bbfa9b
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 2 2
      pboard/pboard/controllers/apipublic.py
  2. 1 0
      pboard/pboard/templates/pod.mak

+ 2 - 2
pboard/pboard/controllers/apipublic.py 查看文件

15
 class PODPublicApiController(plb.BaseController):
15
 class PODPublicApiController(plb.BaseController):
16
 
16
 
17
     @tg.expose()
17
     @tg.expose()
18
-    def create_account(self, email='', password='', retyped_password='', **kw):
18
+    def create_account(self, email='', password='', retyped_password='', real_name='', **kw):
19
       if email=='' or password=='' or retyped_password=='':
19
       if email=='' or password=='' or retyped_password=='':
20
         tg.flash(_('Account creation error: please fill all the fields'), 'error')
20
         tg.flash(_('Account creation error: please fill all the fields'), 'error')
21
         tg.redirect(tg.lurl('/'))
21
         tg.redirect(tg.lurl('/'))
30
 
30
 
31
         loNewAccount = pld.PODStaticController.createUser()
31
         loNewAccount = pld.PODStaticController.createUser()
32
         loNewAccount.email_address = email
32
         loNewAccount.email_address = email
33
-        loNewAccount.display_name  = email
33
+        loNewAccount.display_name  = real_name if real_name!='' else email
34
         loNewAccount.password      = password
34
         loNewAccount.password      = password
35
 
35
 
36
         loUserGroup = pld.PODStaticController.getGroup('user')
36
         loUserGroup = pld.PODStaticController.getGroup('user')

+ 1 - 0
pboard/pboard/templates/pod.mak 查看文件

81
     <form class="well" method="POST" style="min-height: ${psCssMinHeight};" action="${tg.url('/public_api/create_account')}">
81
     <form class="well" method="POST" style="min-height: ${psCssMinHeight};" action="${tg.url('/public_api/create_account')}">
82
       <fieldset>
82
       <fieldset>
83
         <legend>${_('Create an account')}</legend>
83
         <legend>${_('Create an account')}</legend>
84
+        <input type="text"     name="real_name"        id="real_name" placeholder="Name"><br/>
84
         <input type="text"     name="email"            id="email" placeholder="Email"><br/>
85
         <input type="text"     name="email"            id="email" placeholder="Email"><br/>
85
         <input type="password" name="password"         id="password" placeholder="Password"><br/>
86
         <input type="password" name="password"         id="password" placeholder="Password"><br/>
86
         <input type="password" name="retyped_password" id="retyped_password" placeholder="Retype your password"><br/>
87
         <input type="password" name="retyped_password" id="retyped_password" placeholder="Retype your password"><br/>