Commit cba9b332 authored by Alexandre Savard's avatar Alexandre Savard

[#3611] Update account authentication name on username change

parent cd92d21f
......@@ -3,6 +3,7 @@
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -106,6 +107,9 @@ GtkWidget * overrtp;
GHashTable * directIpCallsProperties = NULL;
gchar *current_username;
// Credentials
enum {
COLUMN_CREDENTIAL_REALM,
......@@ -193,12 +197,17 @@ static GPtrArray* getNewCredential (GHashTable * properties) {
-1);
g_hash_table_insert(properties, g_strdup(ACCOUNT_REALM), realm);
g_hash_table_insert(properties, g_strdup(ACCOUNT_AUTHENTICATION_USERNAME), username);
// better use the current_username as it is the account username in the
// g_hash_table_insert(properties, g_strdup(ACCOUNT_AUTHENTICATION_USERNAME), username);
g_hash_table_insert(properties, g_strdup(ACCOUNT_AUTHENTICATION_USERNAME), current_username);
// Do not change the password if nothing has been changed by the user
if (g_strcasecmp (password, PW_HIDDEN) != 0)
g_hash_table_insert(properties, g_strdup(ACCOUNT_PASSWORD), password);
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(credentialStore), &iter);
while (valid) {
......@@ -1251,9 +1260,6 @@ void show_account_window (account_t * a) {
// we must resolve published address from interface name
gchar * local_interface;
gchar * published_address;
gchar *previous_username, *current_username;
gboolean username_changed = FALSE;
currentAccount = a;
......@@ -1351,14 +1357,8 @@ void show_account_window (account_t * a) {
gchar *key = g_strdup(ACCOUNT_USERNAME);
// Get username at loadtime to determine if it changed. If so, update authentication name accordingly
// if(g_hash_table_lookup_extended(currentAccount->properties, g_strdup(ACCOUNT_USERNAME), NULL, previous_username))
// If accept button is
if (g_strcasecmp (currentAccount->accountID, IP2IP) != 0) {
previous_username = (gchar *)g_hash_table_lookup(currentAccount->properties, g_strdup(ACCOUNT_USERNAME));
DEBUG("------------------------------ USERNAME BEFORE %s", previous_username);
g_hash_table_replace(currentAccount->properties,
g_strdup(ACCOUNT_ALIAS),
......@@ -1379,16 +1379,10 @@ void show_account_window (account_t * a) {
g_strdup(ACCOUNT_MAILBOX),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryMailbox))));
// Variable used to update credentials
current_username = (gchar *)g_hash_table_lookup(currentAccount->properties, g_strdup(ACCOUNT_USERNAME));
DEBUG("------------------------------ USERNAME AFTER %s", current_username);
}
if(strcmp(previous_username, current_username) != 0)
username_changed = TRUE;
if(username_changed)
DEBUG("--------------------------------- CHANGED");
}
if (proto && strcmp (proto, "SIP") == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment