Mercurial > moin > 1.9
changeset 955:05b7c435a3d6
Implemented token functions that use the normal moin id
author | Alexander Schremmer <alex AT alexanderweb DOT de> |
---|---|
date | Thu, 29 Jun 2006 19:29:33 +0200 |
parents | a7e98fd10e97 |
children | 413263beeafc |
files | MoinMoin/xmlrpc/__init__.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/xmlrpc/__init__.py Thu Jun 29 12:36:32 2006 +0200 +++ b/MoinMoin/xmlrpc/__init__.py Thu Jun 29 19:29:33 2006 +0200 @@ -504,10 +504,18 @@ def xmlrpc_getAuthToken(self, username, password, *args): """ Returns a token which can be used for authentication in other XMLRPC calls. """ - return "foo" + u = user.User(request, name=username, password=password, auth_method='xmlrpc_gettoken') + if u.valid: + return u.id + else: + return None def xmlrpc_applyAuthToken(self, auth_token, method_name, *args): - # do something with token XXX + u = user.User(request, id=cookie[MOIN_ID].value, auth_method='xmlrpc_applytoken') + if u.valid: + self.request.user = u + else: + raise Exception("Invalid token.") # XXX make a distinct class return self.dispatch(method_name, args) # XXX BEGIN WARNING XXX