changeset 4889:6279b8badd5f

Removed no-value return statements from openid extensions. Prepared default auth login_prompt to have configurable registration url.
author Rowan Kerr <rowan@stasis.org>
date Thu, 28 May 2009 14:00:44 -0400
parents 2d5c306b51df
children 55dc44a8e9ee
files MoinMoin/auth/__init__.py MoinMoin/auth/openidrp_ext/openidrp_sreg.py MoinMoin/auth/openidrp_ext/openidrp_teams.py
diffstat 3 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/auth/__init__.py	Tue May 26 17:35:11 2009 -0400
+++ b/MoinMoin/auth/__init__.py	Thu May 28 14:00:44 2009 -0400
@@ -250,12 +250,24 @@
 
     def login_hint(self, request):
         _ = request.getText
+        #if request.cfg.openidrp_registration_url:
+        #    userprefslink = request.cfg.openidrp_registration_url
+        #else:
         userprefslink = request.page.url(request, querystr={'action': 'newaccount'})
         sendmypasswordlink = request.page.url(request, querystr={'action': 'recoverpass'})
-        return _('If you do not have an account, <a href="%(userprefslink)s">you can create one now</a>. '
-                 '<a href="%(sendmypasswordlink)s">Forgot your password?</a>') % {
-               'userprefslink': userprefslink,
+
+        msg = ''
+        #if request.cfg.openidrp_allow_registration:
+        msg = _('If you do not have an account, <a href="%(userprefslink)s">you can create one now</a>. ') % {
+              'userprefslink': userprefslink}
+        msg += _('<a href="%(sendmypasswordlink)s">Forgot your password?</a>') % {
                'sendmypasswordlink': sendmypasswordlink}
+        return msg
+
+        #return _('If you do not have an account, <a href="%(userprefslink)s">you can create one now</a>. '
+        #         '<a href="%(sendmypasswordlink)s">Forgot your password?</a>') % {
+        #       'userprefslink': userprefslink,
+        #       'sendmypasswordlink': sendmypasswordlink}
 
 
 class GivenAuth(BaseAuth):
--- a/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Tue May 26 17:35:11 2009 -0400
+++ b/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Thu May 28 14:00:44 2009 -0400
@@ -23,18 +23,15 @@
 from pytz import timezone
 import pytz
 
-#class OpenIDSREGAuth(OpenIDAuth):
-#    login_inputs = ['openid_identifier']
-#    name = 'openid'
-#    logout_possible = True
-#    auth_attribs = ['name', 'email', 'aliasname', 'language', 'tz_offset']
+OpenIDAuth.auth_attribs = ('name', 'email', 'aliasname', 'language', 'tz_offset')
 
-OpenIDAuth.auth_attribs = ('name', 'email', 'aliasname', 'language', 'tz_offset')
+openidrp_sreg_required = ['nickname', 'email', 'timezone']
+openidrp_sreg_optional = ['fullname', 'language']
+openidrp_sreg_username_field = 'nickname'
 
 def openidrp_sreg_modify_request(oidreq, cfg):
     oidreq.addExtension(SRegRequest(required=cfg.openidrp_sreg_required,
                                     optional=cfg.openidrp_sreg_optional))
-    return
 
 def openidrp_sreg_create_user(info, u, cfg):
     sreg = _openidrp_sreg_extract_values(info)
@@ -54,7 +51,6 @@
             u.tz_offset = sreg['timezone']
         if sreg['fullname'] != '':
             u.fullname = sreg['fullname']
-    return
 
 def _openidrp_sreg_extract_values(info):
     # Pull SREG data here instead of asking user
--- a/MoinMoin/auth/openidrp_ext/openidrp_teams.py	Tue May 26 17:35:11 2009 -0400
+++ b/MoinMoin/auth/openidrp_ext/openidrp_teams.py	Thu May 28 14:00:44 2009 -0400
@@ -27,19 +27,12 @@
 from MoinMoin.PageEditor import PageEditor, conflict_markers
 from MoinMoin.Page import Page
 
-#class OpenIDTeamsAuth(OpenIDSREGAuth):
-#    login_inputs = ['openid_identifier']
-#    name = 'openid'
-#    logout_possible = True
-#    #auth_attribs = ['name', 'email', 'aliasname', 'language', 'tz_offset']
-
 def openidrp_teams_modify_request(oidreq, cfg):
     # Request Launchpad teams information, if configured
     # should also check supportsTeams() result
     #if teams_extension_avail and len(cfg.openidrp_authorized_teams) > 0:
     if len(cfg.openidrp_authorized_teams) > 0:
         oidreq.addExtension(TeamsRequest(cfg.openidrp_authorized_teams))
-    return
 
 def openidrp_teams_create_user(info, u, cfg):
     # Check for Launchpad teams data in response
@@ -57,7 +50,6 @@
     teams = teams_response.is_member
     if teams:
         _save_teams_acl(u, teams, cfg)
-    return
 
 # Take a list of Launchpad teams and add the user to the ACL pages
 # ACL group names cannot have "-" in them, although team names do.