diff options
author | Manuel Quiñones <manuq@laptop.org> | 2012-04-26 21:29:40 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2012-04-27 16:42:44 (GMT) |
commit | ccd363c1f70a54ce84468c4e850c867a48b6a99e (patch) | |
tree | 9fa7b0dfec5a39a9c2135780eba3e898adc44ddf | |
parent | 394ca67d8004fabcc3a7ee48e9fbe55f42336321 (diff) |
Fix for authentication with school server f6dd764abd7c160e6188757b8e61cd01062a92c6 #3456
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@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | 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) |