diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloatermfa.cpp | 101 | ||||
-rw-r--r-- | indra/newview/llfloatermfa.h | 50 | ||||
-rw-r--r-- | indra/newview/lllogininstance.cpp | 52 | ||||
-rw-r--r-- | indra/newview/lllogininstance.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 9 |
8 files changed, 49 insertions, 189 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 6c976e3f2d..5a06106de3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -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 diff --git a/indra/newview/llfloatermfa.cpp b/indra/newview/llfloatermfa.cpp deleted file mode 100644 index 7710817c23..0000000000 --- a/indra/newview/llfloatermfa.cpp +++ /dev/null @@ -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(); -} diff --git a/indra/newview/llfloatermfa.h b/indra/newview/llfloatermfa.h deleted file mode 100644 index 9332b35877..0000000000 --- a/indra/newview/llfloatermfa.h +++ /dev/null @@ -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 diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index a4c001ad8b..2b1dbc869a 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -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; diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index ce64e9e3be..b759b43474 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -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? diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 677b55e49f..62d73063aa 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -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>); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d4f71fb370..b3c8f5f477 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -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> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index f26ee06e6b..0f045bd19c 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -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> |