changeset 956:413263beeafc

Changed auth token api to authenticate only (no calls because it would not work with MultiCall otherwise
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Thu, 29 Jun 2006 20:23:53 +0200
parents 05b7c435a3d6
children 1b84b9a47129
files MoinMoin/xmlrpc/__init__.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/xmlrpc/__init__.py	Thu Jun 29 19:29:33 2006 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Thu Jun 29 20:23:53 2006 +0200
@@ -503,20 +503,22 @@
     
     def xmlrpc_getAuthToken(self, username, password, *args):
         """ Returns a token which can be used for authentication
-            in other XMLRPC calls. """
-        u = user.User(request, name=username, password=password, auth_method='xmlrpc_gettoken')
+            in other XMLRPC calls. If the token is empty, the username
+            or the password were wrong. """
+        u = user.User(self.request, name=username, password=password, auth_method='xmlrpc_gettoken')
         if u.valid:
             return u.id
         else:
-            return None
+            return ""
     
-    def xmlrpc_applyAuthToken(self, auth_token, method_name, *args):
-        u = user.User(request, id=cookie[MOIN_ID].value, auth_method='xmlrpc_applytoken')
+    def xmlrpc_applyAuthToken(self, auth_token):
+        """ Applies the auth token and thereby authenticates the user. """
+        u = user.User(self.request, id=auth_token, auth_method='xmlrpc_applytoken')
         if u.valid:
             self.request.user = u
+            return "SUCCESS"
         else:
             raise Exception("Invalid token.") # XXX make a distinct class
-        return self.dispatch(method_name, args)
         
     # XXX BEGIN WARNING XXX
     # All xmlrpc_*Attachment* functions have to be considered as UNSTABLE API -