Skip to content

Commit

Permalink
[telepathy-sasl-signon] Use default_credentials_username for fallback
Browse files Browse the repository at this point in the history
Display name is meant to be user-visible and user-modifiable, it's not
suitable for using as a login name. We store
default_credentials_username for that purpose instead.
  • Loading branch information
John Brooks committed Sep 24, 2013
1 parent a5604a7 commit 39f835d
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 39f835d

Please sign in to comment.