Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.userform.login.Login Class Reference

List of all members.

Public Member Functions

def __init__
def make_row
def asHTML

Public Attributes

 request
 cfg

Private Attributes

 _
 _form
 _table

Detailed Description

User login. 

Definition at line 13 of file login.py.


Constructor & Destructor Documentation

def MoinMoin.userform.login.Login.__init__ (   self,
  request 
)
Initialize user settings form.

Definition at line 16 of file login.py.

00016 
00017     def __init__(self, request):
00018         """ Initialize user settings form.
00019         """
00020         self.request = request
00021         self._ = request.getText
00022         self.cfg = request.cfg


Member Function Documentation

Create the complete HTML form code. 

Definition at line 32 of file login.py.

00032 
00033     def asHTML(self):
00034         """ Create the complete HTML form code. """
00035         _ = self._
00036         request = self.request
00037         action = "%s%s" % (request.script_root, request.path)
00038         hints = []
00039         for authm in request.cfg.auth:
00040             hint = authm.login_hint(request)
00041             if hint:
00042                 hints.append(hint)
00043         self._form = html.FORM(action=action, name="loginform", id="loginform")
00044         self._table = html.TABLE(border="0")
00045 
00046         # Use the user interface language and direction
00047         lang_attr = request.theme.ui_lang_attr()
00048         self._form.append(html.Raw('<div class="userpref"%s>' % lang_attr))
00049 
00050         self._form.append(html.INPUT(type="hidden", name="action", value="login"))
00051         self._form.append(self._table)
00052         for hint in hints:
00053             self._form.append(html.P().append(html.Raw(hint)))
00054         self._form.append(html.Raw("</div>"))
00055 
00056         cfg = request.cfg
00057         if 'username' in cfg.auth_login_inputs:
00058             self.make_row(_('Name'), [
00059                 html.INPUT(
00060                     type="text", size="32", name="name",
00061                 ),
00062             ])
00063 
00064         if 'password' in cfg.auth_login_inputs:
00065             self.make_row(_('Password'), [
00066                 html.INPUT(
00067                     type="password", size="32", name="password",
00068                 ),
00069             ])
00070 
00071         # Restrict type of input available for OpenID input
00072         # based on wiki configuration.
00073         if 'openid_identifier' in cfg.auth_login_inputs:
00074             if len(cfg.openidrp_allowed_op) == 1:
00075                 self.make_row(_('OpenID'), [
00076                      html.INPUT(
00077                          type="hidden", name="openid_identifier",
00078                          value=cfg.openidrp_allowed_op[0]
00079                      ),
00080                 ])
00081             elif len(cfg.openidrp_allowed_op) > 1:
00082                 op_select = html.SELECT(name="openid_identifier",
00083                     id="openididentifier")
00084                 for op_uri in cfg.openidrp_allowed_op:
00085                     op_select.append(html.OPTION(value=op_uri).append(
00086                         html.Raw(op_uri)))
00087 
00088                 self.make_row(_('OpenID'), [op_select, ])
00089             else:
00090                 self.make_row(_('OpenID'), [
00091                     html.INPUT(
00092                         type="text", size="32", name="openid_identifier",
00093                         id="openididentifier"
00094                     ),
00095                 ])
00096 
00097         # Need both hidden field and submit values for auto-submit to work
00098         self.make_row('', [
00099             html.INPUT(type="hidden", name="login", value=_('Login')),
00100             html.INPUT(
00101                 type="submit", name='login', value=_('Login')
00102             ),
00103         ])
00104 
00105         # Automatically submit the form if only a single OpenID Provider is allowed
00106         if 'openid_identifier' in cfg.auth_login_inputs and len(cfg.openidrp_allowed_op) == 1:
00107             self._form.append("""<script type="text/javascript">
00108 <!--//
00109 document.getElementById("loginform").submit();
00110 //-->
00111 </script>
00112 """)
00113 
00114         return unicode(self._form)

def MoinMoin.userform.login.Login.make_row (   self,
  label,
  cell,
  kw 
)
Create a row in the form table.

Definition at line 23 of file login.py.

00023 
00024     def make_row(self, label, cell, **kw):
00025         """ Create a row in the form table.
00026         """
00027         self._table.append(html.TR().extend([
00028             html.TD(**kw).extend([html.B().append(label), '   ']),
00029             html.TD().extend(cell),
00030         ]))
00031 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 20 of file login.py.

Definition at line 42 of file login.py.

Definition at line 43 of file login.py.

Definition at line 21 of file login.py.

Definition at line 19 of file login.py.


The documentation for this class was generated from the following file: