# HG changeset patch # User Thomas Waldmann # Date 1132953321 0 # Node ID 9ae17b303304c09a3cc91bdaccf8ff6d56619576 # Parent b80624429934b5e8b63a77ba1859509f75a704b5 added cfg.user_autocreate support for contrib/auth_externalcookie imported from: moin--main--1.5--patch-242 diff -r b80624429934 -r 9ae17b303304 contrib/auth_externalcookie/wikiconfig.py --- 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