def _get_account_name(self, request, form, msg=None): # now we need to ask the user for a new username # that they want to use on this wiki # XXX: request nickname from OP and suggest using it # (if it isn't in use yet) logging.debug("running _get_account_name") _ = request.getText form.append(html.INPUT(type='hidden', name='oidstage', value='2')) table = html.TABLE(border='0') form.append(table) td = html.TD(colspan=2) td.append( html.Raw( _("""Please choose an account name now. If you choose an existing account name you will be asked for the password and be able to associate the account with your OpenID."""))) table.append(html.TR().append(td)) if msg: td = html.TD(colspan='2') td.append(html.P().append(html.STRONG().append(html.Raw(msg)))) table.append(html.TR().append(td)) td1 = html.TD() td1.append(html.STRONG().append(html.Raw(_('Name')))) td2 = html.TD() td2.append(html.INPUT(type='text', name='username')) table.append(html.TR().append(td1).append(td2)) td1 = html.TD() td2 = html.TD() td2.append( html.INPUT(type='submit', name='submit', value=_('Choose this name'))) table.append(html.TR().append(td1).append(td2))
def _associate_account(self, request, form, accountname, msg=None): _ = request.getText form.append(html.INPUT(type='hidden', name='oidstage', value='3')) table = html.TABLE(border='0') form.append(table) td = html.TD(colspan=2) td.append( html.Raw( _("""The username you have chosen is already taken. If it is your username, enter your password below to associate the username with your OpenID. Otherwise, please choose a different username and leave the password field blank."""))) table.append(html.TR().append(td)) if msg: td.append(html.P().append(html.STRONG().append(html.Raw(msg)))) td1 = html.TD() td1.append(html.STRONG().append(html.Raw(_('Name')))) td2 = html.TD() td2.append(html.INPUT(type='text', name='username', value=accountname)) table.append(html.TR().append(td1).append(td2)) td1 = html.TD() td1.append(html.STRONG().append(html.Raw(_('Password')))) td2 = html.TD() td2.append(html.INPUT(type='password', name='password')) table.append(html.TR().append(td1).append(td2)) td1 = html.TD() td2 = html.TD() td2.append( html.INPUT(type='submit', name='submit', value=_('Associate this name'))) table.append(html.TR().append(td1).append(td2))
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='CreateNewAccount')) 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"))))) cell = html.TD() row.append(cell) cell.append(html.INPUT(type="text", size="36", name="name")) cell.append(html.Text(' ' + _("(Use FirstnameLastname)"))) 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="password1"))) 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"))) textcha = TextCha(request) if textcha.is_enabled(): row = html.TR() tbl.append(row) row.append(html.TD().append(html.STRONG().append( html.Text(_('TextCha (required)'))))) td = html.TD() if textcha: td.append(textcha.render()) row.append(td) row = html.TR() tbl.append(row) row.append(html.TD()) td = html.TD() row.append(td) td.append( html.INPUT(type="submit", name="create", value=_('Create Profile'))) return unicode(ret)
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='recoverpass')) 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( _("Username"))))) 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(_("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="account_sendmail", value=_('Mail me my account data'))) return unicode(ret)
def _create_token_form(request, name=None, token=None): _ = request.getText url = request.page.url(request) ret = html.FORM(action=url) ret.append(html.INPUT(type='hidden', name='action', value='recoverpass')) 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(_("Recovery token"))))) value = token or '' row.append(html.TD().append( html.INPUT(type='text', size="36", name="token", value=value))) row = html.TR() tbl.append(row) row.append(html.TD().append(html.STRONG().append(html.Text( _("Username"))))) value = name or '' row.append(html.TD().append( html.INPUT(type='text', size="36", name="name", value=value))) row = html.TR() tbl.append(row) row.append(html.TD().append(html.STRONG().append( html.Text(_("New 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(_("New password (repeat)"))))) row.append(html.TD().append( html.INPUT(type="password", size="36", name="password_repeat"))) row = html.TR() tbl.append(row) row.append(html.TD()) td = html.TD() row.append(td) td.append( html.INPUT(type="submit", name="recover", value=_('Reset my password'))) return unicode(ret)
def show_decide_page(self, identity, username, openidreq): request = self.request _ = self._ if not request.user.valid or username != request.user.name: request.makeForbidden(403, _('''You need to manually go to your OpenID provider wiki and log in before you can use your OpenID. MoinMoin will never allow you to enter your password here. Once you have logged in, simply reload this page.''')) return request.theme.send_title(_("OpenID Trust verification"), pagename=request.page.page_name) # Start content (important for RTL support) request.write(request.formatter.startContent("content")) request.write(request.formatter.paragraph(1)) request.write(_('The site %s has asked for your identity.') % openidreq.trust_root) request.write(request.formatter.paragraph(0)) request.write(request.formatter.paragraph(1)) request.write(_(''' If you approve, the site represented by the trust root below will be told that you control the identity URL %s. (If you are using a delegated identity, the site will take care of reversing the delegation on its own.)''') % openidreq.identity) request.write(request.formatter.paragraph(0)) form = html.FORM(method='POST', action=request.page.url(request)) form.append(html.INPUT(type='hidden', name='action', value='serveopenid')) form.append(html.INPUT(type='hidden', name='openid.identity', value=openidreq.identity)) form.append(html.INPUT(type='hidden', name='openid.return_to', value=openidreq.return_to)) form.append(html.INPUT(type='hidden', name='openid.trust_root', value=openidreq.trust_root)) form.append(html.INPUT(type='hidden', name='openid.mode', value=openidreq.mode)) form.append(html.INPUT(type='hidden', name='name', value=username)) nonce = randomString(32, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') form.append(html.INPUT(type='hidden', name='nonce', value=nonce)) request.session['openidserver.nonce'] = nonce table = html.TABLE() form.append(table) tr = html.TR() table.append(tr) tr.append(html.TD().append(html.STRONG().append(html.Text(_('Trust root'))))) tr.append(html.TD().append(html.Text(openidreq.trust_root))) tr = html.TR() table.append(tr) tr.append(html.TD().append(html.STRONG().append(html.Text(_('Identity URL'))))) tr.append(html.TD().append(html.Text(identity))) tr = html.TR() table.append(tr) tr.append(html.TD().append(html.STRONG().append(html.Text(_('Name'))))) tr.append(html.TD().append(html.Text(username))) tr = html.TR() table.append(tr) tr.append(html.TD().append(html.STRONG().append(html.Text(_('Remember decision'))))) td = html.TD() tr.append(td) td.append(html.INPUT(type='checkbox', name='remember', value='yes')) td.append(html.Text(_('Remember this trust decision and don\'t ask again'))) tr = html.TR() table.append(tr) tr.append(html.TD()) td = html.TD() tr.append(td) td.append(html.INPUT(type='submit', name='approve', value=_("Approve"))) td.append(html.INPUT(type='submit', name='dontapprove', value=_("Don't approve"))) request.write(unicode(form)) request.write(request.formatter.endContent()) request.theme.send_footer(request.page.page_name) request.theme.send_closing_html()