Skip to content

Commit 0296bd6

Browse files
#p430 don't show MFA dialog twice
1 parent d5313e7 commit 0296bd6

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

indra/newview/lllogininstance.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
329329
LL_DEBUGS("LLLogin") << "reason " << reason_response
330330
<< " message " << message_response
331331
<< LL_ENDL;
332+
333+
if (response.has("mfa_hash"))
334+
{
335+
mRequestData["params"]["mfa_hash"] = response["mfa_hash"];
336+
mRequestData["params"]["token"] = "";
337+
338+
saveMFAHash(response);
339+
}
340+
332341
// For the cases of critical message or TOS agreement,
333342
// start the TOS dialog. The dialog response will be handled
334343
// by the LLLoginInstance::handleTOSResponse() callback.
@@ -593,6 +602,24 @@ bool LLLoginInstance::handleMFAChallenge(LLSD const & notif, LLSD const & respon
593602
return true;
594603
}
595604

605+
void LLLoginInstance::saveMFAHash(LLSD const& response)
606+
{
607+
std::string grid(LLGridManager::getInstance()->getGridId());
608+
std::string user_id(LLStartUp::getUserId());
609+
610+
// Only save mfa_hash for future logins if the user wants their info remembered.
611+
if (response.has("mfa_hash") && gSavedSettings.getBOOL("RememberUser") && LLLoginInstance::getInstance()->saveMFA())
612+
{
613+
gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]);
614+
}
615+
else if (!LLLoginInstance::getInstance()->saveMFA())
616+
{
617+
gSecAPIHandler->removeFromProtectedMap("mfa_hash", grid, user_id);
618+
}
619+
// TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically
620+
gSecAPIHandler->syncProtectedMap();
621+
}
622+
596623
std::string construct_start_string()
597624
{
598625
std::string start;

indra/newview/lllogininstance.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
7070
void setNotificationsInterface(LLNotificationsInterface* ni) { mNotifications = ni; }
7171
LLNotificationsInterface& getNotificationsInterface() const { return *mNotifications; }
7272

73+
void saveMFAHash(LLSD const& response);
74+
7375
private:
7476
typedef std::shared_ptr<LLEventAPI::Response> ResponsePtr;
7577
void constructAuthParams(LLPointer<LLCredential> user_credentials);

indra/newview/llstartup.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3884,25 +3884,7 @@ bool process_login_success_response()
38843884
LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token);
38853885
}
38863886

3887-
3888-
// Only save mfa_hash for future logins if the user wants their info remembered.
3889-
if(response.has("mfa_hash")
3890-
&& gSavedSettings.getBOOL("RememberUser")
3891-
&& LLLoginInstance::getInstance()->saveMFA())
3892-
{
3893-
std::string grid(LLGridManager::getInstance()->getGridId());
3894-
std::string user_id(gUserCredential->userID());
3895-
gSecAPIHandler->addToProtectedMap("mfa_hash", grid, user_id, response["mfa_hash"]);
3896-
// TODO(brad) - related to SL-17223 consider building a better interface that sync's automatically
3897-
gSecAPIHandler->syncProtectedMap();
3898-
}
3899-
else if (!LLLoginInstance::getInstance()->saveMFA())
3900-
{
3901-
std::string grid(LLGridManager::getInstance()->getGridId());
3902-
std::string user_id(gUserCredential->userID());
3903-
gSecAPIHandler->removeFromProtectedMap("mfa_hash", grid, user_id);
3904-
gSecAPIHandler->syncProtectedMap();
3905-
}
3887+
LLLoginInstance::getInstance()->saveMFAHash(response);
39063888

39073889
bool success = false;
39083890
// JC: gesture loading done below, when we have an asset system

0 commit comments

Comments
 (0)