From 0089e4b36a516d169e60c7dbf925835b733096c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 19 Jul 2018 16:44:26 -0400
Subject: [PATCH] newaccountmodel: set SIP credentials

Change-Id: I5b5e57528a7ea8f0f60e209899bc3740176931b0
Gitlab: #375
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
---
 src/newaccountmodel.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp
index fa71c8fc..47110bbe 100644
--- a/src/newaccountmodel.cpp
+++ b/src/newaccountmodel.cpp
@@ -184,6 +184,17 @@ NewAccountModel::setAccountConfig(const std::string& accountId,
         details[ConfProperties::USERNAME] = toQString(confProperties.username);
     }
     configurationManager.setAccountDetails(QString::fromStdString(accountId), details);
+
+    // Refresh credentials for SIP accounts
+    if (accountInfo.profileInfo.type == profile::Type::SIP) {
+        MapStringString credentials;
+        credentials[ConfProperties::USERNAME] = toQString(confProperties.username);
+        credentials[ConfProperties::PASSWORD] = toQString(confProperties.password);
+        credentials[ConfProperties::REALM] = QString("*");
+        QVector<MapStringString> credentialsVec;
+        credentialsVec.append(credentials);
+        ConfigurationManager::instance().setCredentials(accountId.c_str(), credentialsVec);
+    }
 }
 
 account::ConfProperties_t
-- 
GitLab