From 5366d7ed05765d51b87d81a143e945824aa6ce52 Mon Sep 17 00:00:00 2001
From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Fri, 14 Dec 2018 14:21:14 -0500
Subject: [PATCH] register account: save name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Save account registered name after name registration ended

Change-Id: Iff64d09870dc1b9592b8a4295f08e6fa1a54a38b
Reviewed-by: Sébastien Blin <sebeastien.blin@savoirfairelinux.com>
---
 src/newaccountmodel.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/newaccountmodel.cpp b/src/newaccountmodel.cpp
index 3534e6d1..cdf34bcc 100644
--- a/src/newaccountmodel.cpp
+++ b/src/newaccountmodel.cpp
@@ -468,9 +468,15 @@ NewAccountModelPimpl::slotNameRegistrationEnded(const std::string& accountId, in
     account::RegisterNameStatus convertedStatus = account::RegisterNameStatus::INVALID;
     switch (status)
     {
-    case 0:
+    case 0: {
         convertedStatus = account::RegisterNameStatus::SUCCESS;
-        break;
+        auto accountInfo = accounts.find(accountId);
+        if (accountInfo != accounts.end() && accountInfo->second.registeredName.empty()) {
+            auto conf = linked.getAccountConfig(accountId);
+            linked.setAccountConfig(accountId, conf);
+            break;
+        }
+      }
     case 1:
         convertedStatus = account::RegisterNameStatus::WRONG_PASSWORD;
         break;
-- 
GitLab