From 30cd108c7e4a524c9f17060d5b2f7b4ff193b4b8 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Mon, 6 Dec 2021 16:17:55 -0800 Subject: SL-16388 Viewer MFA Implementation Improvements token input is now handled and message formatting is improved. Added beginnings of support for saving slmfa_hash value client side. --- indra/newview/llfloatermfa.cpp | 27 +++++++++++----------- indra/newview/lllogininstance.cpp | 1 + indra/newview/skins/default/xui/en/floater_mfa.xml | 25 ++++++++++---------- 3 files changed, 28 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermfa.cpp b/indra/newview/llfloatermfa.cpp index 9fb6788923..9356605b8c 100644 --- a/indra/newview/llfloatermfa.cpp +++ b/indra/newview/llfloatermfa.cpp @@ -46,35 +46,36 @@ LLFloaterMFA::~LLFloaterMFA() BOOL LLFloaterMFA::postBuild() { - childSetAction("Continue", onContinue, this); - childSetAction("Cancel", onCancel, this); + centerOnScreen(); - if (hasChild("token_prompt")) + childSetAction("continue_btn", onContinue, this); + childSetAction("cancel_btn", onCancel, this); + childSetCommitCallback("token_edit", [](LLUICtrl*, void* userdata) { onContinue(userdata);}, this); + + if (hasChild("token_prompt_text")) { // this displays the prompt message - LLUICtrl *token_prompt = getChild("token_prompt"); + LLUICtrl *token_prompt = getChild("token_prompt_text"); token_prompt->setEnabled( FALSE ); token_prompt->setFocus(TRUE); token_prompt->setValue(LLSD(mMessage)); - - return TRUE; } return TRUE; } // static -void LLFloaterMFA::onContinue( void* userdata ) +void LLFloaterMFA::onContinue(void* userdata ) { - LLFloaterMFA* self = (LLFloaterMFA*) userdata; + LLFloaterMFA* self = static_cast(userdata); LL_INFOS("MFA") << "User submits MFA token for challenge." << LL_ENDL; - std::string token{"8675309"}; + std::string token; - if (self->hasChild("token")) + if (self->hasChild("token_edit")) { // this displays the prompt message - LLUICtrl *token_ctrl = self->getChild("token"); + LLUICtrl *token_ctrl = self->getChild("token_edit"); token = token_ctrl->getValue().asStringRef(); } @@ -88,9 +89,9 @@ void LLFloaterMFA::onContinue( void* userdata ) } // static -void LLFloaterMFA::onCancel( void* userdata ) +void LLFloaterMFA::onCancel(void* userdata) { - LLFloaterMFA* self = (LLFloaterMFA*) userdata; + LLFloaterMFA* self = static_cast(userdata); LL_INFOS("MFA") << "User cancels MFA challenge attempt." << LL_ENDL; if(self->mReplyPumpName != "") diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index e380e5a3f4..553a8c91ff 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -228,6 +228,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia request_params["host_id"] = gSavedSettings.getString("HostID"); request_params["extended_errors"] = true; // request message_id and message_args request_params["token"] = ""; + request_params["slmfa_hash"] = ""; // log request_params _before_ adding the credentials LL_DEBUGS("LLLogin") << "Login parameters: " << LLSDOStreamer(request_params) << LL_ENDL; diff --git a/indra/newview/skins/default/xui/en/floater_mfa.xml b/indra/newview/skins/default/xui/en/floater_mfa.xml index acdfbc82c0..361641d313 100644 --- a/indra/newview/skins/default/xui/en/floater_mfa.xml +++ b/indra/newview/skins/default/xui/en/floater_mfa.xml @@ -1,42 +1,43 @@ token prompt - + name="token_edit" + width="100" />