changeset 3139:0c0fd7c894a3

allow auth methods that don't need input at all to skip input form
author Johannes Berg <johannes AT sipsolutions DOT net>
date Wed, 27 Feb 2008 15:31:28 +0100
parents 2ba284b78861
children 232b1fcfadab
files MoinMoin/auth/__init__.py MoinMoin/theme/__init__.py
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/auth/__init__.py	Wed Feb 27 15:29:10 2008 +0100
+++ b/MoinMoin/auth/__init__.py	Wed Feb 27 15:31:28 2008 +0100
@@ -93,6 +93,11 @@
                       - 'username': username entry field
                       - 'password': password entry field
                       - 'openid_identifier': OpenID entry field
+                      - 'special_no_input': manual login is required
+                            but no form fields need to be filled in
+                            (for example openid with forced provider)
+                            in this case the theme may provide a short-
+                            cut omitting the login form
      * logout_possible: boolean indicating whether this auth methods
                         supports logging out
      * name: name of the auth method, must be the same as given as the
--- a/MoinMoin/theme/__init__.py	Wed Feb 27 15:29:10 2008 +0100
+++ b/MoinMoin/theme/__init__.py	Wed Feb 27 15:31:28 2008 +0100
@@ -285,9 +285,13 @@
                 userlinks.append(d['page'].link_to(request, text=_('Logout', formatted=False),
                                                    querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
         else:
+            query = {'action': 'login'}
+            # special direct-login link if the auth methods want no input
+            if request.cfg.auth_login_inputs == ['special_no_input']:
+                query['login'] = '1'
             if request.cfg.auth_have_login:
                 userlinks.append(d['page'].link_to(request, text=_("Login", formatted=False),
-                                                   querystr={'action': 'login'}, id='login', rel='nofollow'))
+                                                   querystr=query, id='login', rel='nofollow'))
 
         userlinks = [u'<li>%s</li>' % link for link in userlinks]
         html = u'<ul id="username">%s</ul>' % ''.join(userlinks)