From bf44a88f98d60143b66cecf0fa172ad2159aed5e Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Mon, 11 Mar 2019 15:37:05 +0300 Subject: [PATCH] Fixed reset user-bound properties on authentication losing --- map/user.cpp | 11 ++++++++++- map/user.hpp | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/map/user.cpp b/map/user.cpp index ab7d8c3698..7b1e0def8f 100644 --- a/map/user.cpp +++ b/map/user.cpp @@ -271,7 +271,16 @@ void User::ResetAccessToken() { std::lock_guard lock(m_mutex); m_accessToken.clear(); - GetPlatform().GetSecureStorage().Remove(kMapsMeTokenKey); + m_userName.clear(); + m_userId.clear(); + m_details = {}; + + // Reset all user-bound keys. + std::vector const kKeysToRemove = {{kMapsMeTokenKey, kReviewIdsKey, + kUserNameKey, kUserIdKey}}; + for (auto const & k : kKeysToRemove) + GetPlatform().GetSecureStorage().Remove(k); + NotifySubscribersImpl(); } diff --git a/map/user.hpp b/map/user.hpp index 69246e157c..ed17334a5d 100644 --- a/map/user.hpp +++ b/map/user.hpp @@ -99,10 +99,11 @@ private: std::string m_accessToken; std::string m_userName; std::string m_userId; - mutable std::mutex m_mutex; bool m_authenticationInProgress = false; Details m_details; std::vector> m_subscribers; + + mutable std::mutex m_mutex; }; namespace lightweight