SL-16654 simplify MFA token prompt UI to use notifications instead of new custom floater.
parent
96a6d21086
commit
990bee7ee2
|
|
@ -275,7 +275,6 @@ set(viewer_SOURCE_FILES
|
|||
llfloatermap.cpp
|
||||
llfloatermediasettings.cpp
|
||||
llfloatermemleak.cpp
|
||||
llfloatermfa.cpp
|
||||
llfloatermodelpreview.cpp
|
||||
llfloatermodeluploadbase.cpp
|
||||
llfloatermyscripts.cpp
|
||||
|
|
@ -919,7 +918,6 @@ set(viewer_HEADER_FILES
|
|||
llfloatermarketplacelistings.h
|
||||
llfloatermediasettings.h
|
||||
llfloatermemleak.h
|
||||
llfloatermfa.h
|
||||
llfloatermodelpreview.h
|
||||
llfloatermodeluploadbase.h
|
||||
llfloatermyscripts.h
|
||||
|
|
|
|||
|
|
@ -1,101 +0,0 @@
|
|||
/**
|
||||
* @file llfloatermfa.cpp
|
||||
* @brief Multi-Factor Auth token submission dialog
|
||||
*
|
||||
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2021, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llfloatermfa.h"
|
||||
|
||||
// viewer includes
|
||||
#include "llevents.h"
|
||||
|
||||
|
||||
LLFloaterMFA::LLFloaterMFA(const LLSD& data)
|
||||
: LLModalDialog("mfa_challenge"),
|
||||
mMessage(data["message"].asStringRef()),
|
||||
mReplyPumpName(data["reply_pump"].asStringRef())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LLFloaterMFA::~LLFloaterMFA()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLFloaterMFA::postBuild()
|
||||
{
|
||||
centerOnScreen();
|
||||
|
||||
childSetAction("continue_btn", onContinue, this);
|
||||
childSetAction("cancel_btn", onCancel, this);
|
||||
childSetCommitCallback("token_edit", [](LLUICtrl*, void* userdata) { onContinue(userdata);}, this);
|
||||
|
||||
// this displays the prompt message
|
||||
LLUICtrl *token_prompt = getChild<LLUICtrl>("token_prompt_text");
|
||||
token_prompt->setEnabled( FALSE );
|
||||
token_prompt->setValue(LLSD(mMessage));
|
||||
|
||||
LLUICtrl *token_edit = getChild<LLUICtrl>("token_edit");
|
||||
token_edit->setFocus(TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterMFA::onContinue(void* userdata )
|
||||
{
|
||||
LLFloaterMFA* self = static_cast<LLFloaterMFA*>(userdata);
|
||||
|
||||
LLUICtrl *token_ctrl = self->getChild<LLUICtrl>("token_edit");
|
||||
|
||||
std::string token(token_ctrl->getValue().asStringRef());
|
||||
|
||||
if (!token.empty())
|
||||
{
|
||||
LL_INFOS("MFA") << "User submits MFA token for challenge." << LL_ENDL;
|
||||
if(self->mReplyPumpName != "")
|
||||
{
|
||||
LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(token));
|
||||
}
|
||||
|
||||
self->closeFloater(); // destroys this object
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterMFA::onCancel(void* userdata)
|
||||
{
|
||||
LLFloaterMFA* self = static_cast<LLFloaterMFA*>(userdata);
|
||||
LL_INFOS("MFA") << "User cancels MFA challenge attempt." << LL_ENDL;
|
||||
|
||||
if(self->mReplyPumpName != "")
|
||||
{
|
||||
LL_DEBUGS("MFA") << self->mReplyPumpName << LL_ENDL;
|
||||
LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD());
|
||||
}
|
||||
|
||||
// destroys this object
|
||||
self->closeFloater();
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* @file llfloatermfa.h
|
||||
* @brief Multi-Factor Auth token submission dialog
|
||||
*
|
||||
* $LicenseInfo:firstyear=2021&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2021, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLFLOATERMFA_H
|
||||
#define LL_LLFLOATERMFA_H
|
||||
|
||||
#include "llmodaldialog.h"
|
||||
|
||||
|
||||
class LLFloaterMFA :
|
||||
public LLModalDialog
|
||||
{
|
||||
public:
|
||||
LLFloaterMFA(const LLSD& data);
|
||||
virtual ~LLFloaterMFA();
|
||||
|
||||
BOOL postBuild();
|
||||
|
||||
static void onContinue(void* userdata);
|
||||
static void onCancel(void* userdata);
|
||||
|
||||
private:
|
||||
std::string mMessage;
|
||||
std::string mReplyPumpName;
|
||||
};
|
||||
|
||||
#endif // LL_FLOATERMFA_H
|
||||
|
|
@ -75,8 +75,6 @@ public:
|
|||
|
||||
static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
|
||||
static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
|
||||
static const char * const MFA_REPLY_PUMP = "lllogininstance_mfa_callback";
|
||||
static const char * const MFA_LISTENER_NAME = "lllogininstance_mfa";
|
||||
|
||||
std::string construct_start_string();
|
||||
|
||||
|
|
@ -424,18 +422,30 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
|
|||
{
|
||||
LL_DEBUGS("LLLogin") << " MFA challenge" << LL_ENDL;
|
||||
|
||||
LLSD data(LLSD::emptyMap());
|
||||
data["message"] = message_response;
|
||||
data["reply_pump"] = MFA_REPLY_PUMP
|
||||
if (gViewerWindow)
|
||||
{
|
||||
gViewerWindow->setShowProgress(FALSE);
|
||||
}
|
||||
LLFloaterReg::showInstance("message_mfa", data);
|
||||
LLEventPumps::instance().obtain(MFA_REPLY_PUMP)
|
||||
.listen(MFA_LISTENER_NAME, [=](const LLSD& token) {
|
||||
return this->handleMFAResponse(token, "token");
|
||||
});
|
||||
|
||||
LLSD args(llsd::map( "MESSAGE", LLTrans::getString(response["message_id"]) ));
|
||||
LLSD payload;
|
||||
LLNotificationsUtil::add("PromptMFAToken", args, payload, [=](LLSD const & notif, LLSD const & response) {
|
||||
bool continue_clicked = response["continue"].asBoolean();
|
||||
LLSD token = response["token"];
|
||||
LL_DEBUGS("LLLogin") << "PromptMFAToken: response: " << response << " continue_clicked" << continue_clicked << LL_ENDL;
|
||||
|
||||
if (continue_clicked && !token.asString().empty())
|
||||
{
|
||||
LL_INFOS("LLLogin") << "PromptMFAToken: token submitted" << LL_ENDL;
|
||||
|
||||
// Set the request data to true and retry login.
|
||||
mRequestData["params"]["token"] = token;
|
||||
reconnect();
|
||||
} else {
|
||||
LL_INFOS("LLLogin") << "PromptMFAToken: no token, attemptComplete" << LL_ENDL;
|
||||
attemptComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if( reason_response == "key"
|
||||
|| reason_response == "presence"
|
||||
|
|
@ -531,28 +541,6 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool LLLoginInstance::handleMFAResponse(const std::string& token, const std::string& key)
|
||||
{
|
||||
LLEventPumps::instance().obtain(MFA_REPLY_PUMP).stopListening(MFA_LISTENER_NAME);
|
||||
|
||||
if(!token.empty())
|
||||
{
|
||||
LL_INFOS("LLLogin") << "LLLoginInstance::handleMFAResponse: token submitted" << LL_ENDL;
|
||||
|
||||
// Set the request data to true and retry login.
|
||||
mRequestData["params"][key] = token;
|
||||
reconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_INFOS("LLLogin") << "LLLoginInstance::handleMFAResponse: no token, attemptComplete" << LL_ENDL;
|
||||
|
||||
attemptComplete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string construct_start_string()
|
||||
{
|
||||
std::string start;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ private:
|
|||
void syncWithUpdater(ResponsePtr resp, const LLSD& notification, const LLSD& response);
|
||||
|
||||
bool handleTOSResponse(bool v, const std::string& key);
|
||||
bool handleMFAResponse(const std::string& v, const std::string& key);
|
||||
|
||||
void attemptComplete() { mAttemptComplete = true; } // In the future an event?
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@
|
|||
#include "llfloatermarketplacelistings.h"
|
||||
#include "llfloatermediasettings.h"
|
||||
#include "llfloatermemleak.h"
|
||||
#include "llfloatermfa.h"
|
||||
#include "llfloatermodelpreview.h"
|
||||
#include "llfloatermyscripts.h"
|
||||
#include "llfloatermyenvironment.h"
|
||||
|
|
@ -289,7 +288,6 @@ void LLViewerFloaterReg::registerFloaters()
|
|||
LLFloaterReg::add("marketplace_validation", "floater_marketplace_validation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMarketplaceValidation>);
|
||||
LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
|
||||
LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>);
|
||||
LLFloaterReg::add("message_mfa", "floater_mfa.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMFA>);
|
||||
LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>);
|
||||
LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGetBlockedObjectName>);
|
||||
LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>);
|
||||
|
|
|
|||
|
|
@ -11778,4 +11778,25 @@ Unable to load the track from [TRACK1] into [TRACK2].
|
|||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
label="Prompt for MFA Token"
|
||||
name="PromptMFAToken"
|
||||
type="alertmodal">
|
||||
[MESSAGE]
|
||||
<tag>confirm</tag>
|
||||
<form name="form">
|
||||
<input name="token" type="text" width="400" />
|
||||
<button
|
||||
default="true"
|
||||
index="0"
|
||||
name="continue"
|
||||
text="Continue"/>
|
||||
<button
|
||||
index="1"
|
||||
name="cancel"
|
||||
text="Cancel"/>
|
||||
</form>
|
||||
</notification>
|
||||
|
||||
</notifications>
|
||||
|
|
|
|||
|
|
@ -192,7 +192,14 @@ Please try logging in again in a minute.</string>
|
|||
Please try logging in again in a minute.</string>
|
||||
<string name="LoginFailedLoggingOutSession">The system has begun logging out your last session.
|
||||
Please try logging in again in a minute.</string>
|
||||
|
||||
<string name="LoginFailedAuthenticationMFARequired">To continue logging in, enter a new token from your multifactor authentication app.
|
||||
If you feel this is an error, please contact support@secondlife.com</string>
|
||||
<string name="LoginFailedAuthenticationFailedMFA">Sorry! We couldn't log you in.
|
||||
Please check to make sure you entered the right
|
||||
* Username (like bobsmith12 or steller.sunshine)
|
||||
* Password
|
||||
* Token
|
||||
Also, please make sure your Caps Lock key is off.</string>
|
||||
|
||||
<!-- Disconnection -->
|
||||
<string name="AgentLostConnection">This region may be experiencing trouble. Please check your connection to the Internet.</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue