Skip to content

Commit

Permalink
Merge pull request #5 from special/default-username
Browse files Browse the repository at this point in the history
[telepathy-sasl-signon] Use default_credentials_username for fallback
  • Loading branch information
special committed Sep 24, 2013
2 parents a5604a7 + 39f835d commit 1a95c10
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions telepathy-sasl-signon/empathy-uoa-auth-handler.c
Expand Up @@ -286,10 +286,21 @@ identity_query_info_cb (SignonIdentity *identity,
ctx->username = g_strdup (signon_identity_info_get_username (info));
if (!ctx->username || !*ctx->username)
{
g_free(ctx->username);
GVariant *v;
AgAccount *account = ag_account_service_get_account (ctx->service);
ctx->username = g_strdup (ag_account_get_display_name (account));
DEBUG ("No username in signon data, falling back to account display name (%s) as username", ctx->username);
AgService *old_service = ag_account_get_selected_service (account);
ag_account_select_service (account, NULL);

g_free (ctx->username);
v = ag_account_get_variant (account, "default_credentials_username", NULL);
if (v)
ctx->username = g_variant_dup_string (v, NULL);
else
ctx->username = NULL;

ag_account_select_service (account, old_service);

DEBUG ("No username in signon data, falling back to default_credentials_username '%s'", ctx->username);
}

GHashTable *params = ag_auth_data_get_parameters (ctx->auth_data);
Expand Down

0 comments on commit 1a95c10

Please sign in to comment.