Cherry pick MFA Dialogue fix for TOS change.

master
Beq 2025-05-22 23:01:27 +01:00
parent 399a14db55
commit 13d2de35d2
3 changed files with 31 additions and 18 deletions

View File

@ -346,6 +346,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.
@ -609,6 +618,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;

View File

@ -73,6 +73,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);

View File

@ -4973,24 +4973,7 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y
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);
// <FS:Ansariel> OpenSim legacy economy support
#ifdef OPENSIM
@ -5093,6 +5076,7 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y
}
// </FS:Techwolf Lupindo>
bool success = false;
// JC: gesture loading done below, when we have an asset system
// in place. Don't delete/clear gUserCredentials until then.