changeset 239:9ae17b303304

added cfg.user_autocreate support for contrib/auth_externalcookie imported from: moin--main--1.5--patch-242
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 25 Nov 2005 21:15:21 +0000
parents b80624429934
children 983e3a3a9b9e
files contrib/auth_externalcookie/wikiconfig.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/auth_externalcookie/wikiconfig.py	Fri Nov 25 20:55:24 2005 +0000
+++ b/contrib/auth_externalcookie/wikiconfig.py	Fri Nov 25 21:15:21 2005 +0000
@@ -10,6 +10,7 @@
     def external_cookie(request):
         """ authenticate via external cookie """
         import Cookie
+        user = None
         cookiename = "whatever" # XXX external cookie name you want to use
         try:
             cookie = Cookie.SimpleCookie(request.saved_cookie)
@@ -47,11 +48,11 @@
                 user.aliasname = aliasname ; changed = True # yes -> update user profile
             if email != user.email: # was the email addr externally updated?
                 user.email = email ; changed = True # yes -> update user profile
-
-            if not user.valid and not user.disabled or changed: # do we need to save/update?
-                user.save() # yes, create/update user profile
-            if user.valid: # did we succeed making up a valid user?
-                return user # yes, return user object and stop processing auth method list
+            
+            if u:
+                u.create_or_update(changed)
+            if u and u.valid: # did we succeed making up a valid user?
+                return u # yes, return user object and stop processing auth method list
         return None # no, return None and continue with next method in auth list
 
     from MoinMoin.auth import moin_cookie, http