[Sugar-devel] [PATCH Browse] Fix for authentication with school server f6dd764abd7c160e6188757b8e61cd01062a92c6 #3456

Simon Schampijer simon at schampijer.de
Fri Apr 27 11:19:01 EDT 2012


This patch looks good. And I applied it and do not see any regressions 
at least. Can we get it tested with the school server? Sam can you have 
a look if this is the final result we would like to see?

Regards,
    Simon


On 04/26/2012 11:31 PM, Manuel Quiñones wrote:
> 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)



More information about the Sugar-devel mailing list