[Sugar-devel] [PATCH Browse] Fix for authentication with school server f6dd764abd7c160e6188757b8e61cd01062a92c6 #3456
Manuel Quiñones
manuq at laptop.org
Thu Apr 26 17:31:33 EDT 2012
The cookie is now correctly set to the Jabber server URI
'xmpp://JABBER_SERVER/', being JABBER_SERVER the value of
'/desktop/sugar/collaboration/jabber_server' GConf setting.
In 8b7a3b5cebb8ed7ead60841d052c02753d09ac34 cjson.encode was
accidentally renamed to json.loads instead of json.dumps, this patch
also fixes that.
Tested authentication with a school server, it succeeds.
Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
webactivity.py | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/webactivity.py b/webactivity.py
index 0d317d8..156ea3c 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -92,17 +92,18 @@ def _seed_xs_cookie(cookie_jar):
_logger.debug('seed_xs_cookie: Not registered with Schoolserver')
return
- # Using new() here because the GObject constructor can't be used
- # in this case. The code we need is locked up behind .new().
- soup_uri = Soup.URI.new(uri_string=backup_url)
+ jabber_server = client.get_string(
+ '/desktop/sugar/collaboration/jabber_server')
+
+ soup_uri = Soup.URI()
+ soup_uri.set_scheme('xmpp')
+ soup_uri.set_host(jabber_server)
+ soup_uri.set_path('/')
xs_cookie = cookie_jar.get_cookies(soup_uri, for_http=False)
if xs_cookie is not None:
_logger.debug('seed_xs_cookie: Cookie exists already')
return
- jabber_server = client.get_string(
- '/desktop/sugar/collaboration/jabber_server')
-
pubkey = profile.get_profile().pubkey
cookie_data = {'color': profile.get_color().to_string(),
'pkey_hash': sha1(pubkey).hexdigest()}
@@ -111,7 +112,7 @@ def _seed_xs_cookie(cookie_jar):
xs_cookie = Soup.Cookie()
xs_cookie.set_name('xoid')
- xs_cookie.set_value(json.loads(cookie_data))
+ xs_cookie.set_value(json.dumps(cookie_data))
xs_cookie.set_domain(jabber_server)
xs_cookie.set_path('/')
xs_cookie.set_max_age(expire)
--
1.7.7.6
More information about the Sugar-devel
mailing list