diff options
| author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2025-05-21 02:50:39 +0300 | 
|---|---|---|
| committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2025-05-21 02:50:39 +0300 | 
| commit | 0296bd6ca78a8f962e42156265a57e07bb6c1164 (patch) | |
| tree | 84f4d8458b7e18298bf490dc194c8bc3017584e0 | |
| parent | d5313e7161bb99045adc4a1a34d7f85de609d97b (diff) | |
#p430 don't show MFA dialog twice
| -rw-r--r-- | indra/newview/lllogininstance.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/lllogininstance.h | 2 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 20 | 
3 files changed, 30 insertions, 19 deletions
| diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index cbc3744aa3..4bffe7feac 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -329,6 +329,15 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)      LL_DEBUGS("LLLogin") << "reason " << reason_response                           << " message " << message_response                           << LL_ENDL; + +    if (response.has("mfa_hash")) +    { +        mRequestData["params"]["mfa_hash"] = response["mfa_hash"]; +        mRequestData["params"]["token"] = ""; + +        saveMFAHash(response); +    } +      // For the cases of critical message or TOS agreement,      // start the TOS dialog. The dialog response will be handled      // by the LLLoginInstance::handleTOSResponse() callback. @@ -593,6 +602,24 @@ bool LLLoginInstance::handleMFAChallenge(LLSD const & notif, LLSD const & respon      return true;  } +void LLLoginInstance::saveMFAHash(LLSD const& response) +{ +    std::string grid(LLGridManager::getInstance()->getGridId()); +    std::string user_id(LLStartUp::getUserId()); + +    // Only save mfa_hash for future logins if the user wants their info remembered. +    if (response.has("mfa_hash") && gSavedSettings.getBOOL("RememberUser") && LLLoginInstance::getInstance()->saveMFA()) +    { +        gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]); +    } +    else if (!LLLoginInstance::getInstance()->saveMFA()) +    { +        gSecAPIHandler->removeFromProtectedMap("mfa_hash", grid, user_id); +    } +    // TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically +    gSecAPIHandler->syncProtectedMap(); +} +  std::string construct_start_string()  {      std::string start; diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 748909c069..941b378b14 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -70,6 +70,8 @@ public:      void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; }      LLNotificationsInterface& getNotificationsInterface() const { return *mNotifications; } +    void saveMFAHash(LLSD const& response); +  private:      typedef std::shared_ptr<LLEventAPI::Response> ResponsePtr;      void constructAuthParams(LLPointer<LLCredential> user_credentials); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 4f60f98b49..cc4f49c0b4 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3884,25 +3884,7 @@ bool process_login_success_response()          LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token);      } - -    // Only save mfa_hash for future logins if the user wants their info remembered. -    if(response.has("mfa_hash") -       && gSavedSettings.getBOOL("RememberUser") -       && LLLoginInstance::getInstance()->saveMFA()) -    { -        std::string grid(LLGridManager::getInstance()->getGridId()); -        std::string user_id(gUserCredential->userID()); -        gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]); -        // TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically -        gSecAPIHandler->syncProtectedMap(); -    } -    else if (!LLLoginInstance::getInstance()->saveMFA()) -    { -        std::string grid(LLGridManager::getInstance()->getGridId()); -        std::string user_id(gUserCredential->userID()); -        gSecAPIHandler->removeFromProtectedMap("mfa_hash", grid, user_id); -        gSecAPIHandler->syncProtectedMap(); -    } +    LLLoginInstance::getInstance()->saveMFAHash(response);      bool success = false;      // JC: gesture loading done below, when we have an asset system | 
