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.
meow-7.2.2
Brad Kittenbrink 2021-12-06 16:17:55 -08:00
parent d307843dd4
commit 30cd108c7e
3 changed files with 28 additions and 25 deletions

View File

@ -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<LLUICtrl>("token_prompt");
LLUICtrl *token_prompt = getChild<LLUICtrl>("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<LLFloaterMFA*>(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<LLUICtrl>("token");
LLUICtrl *token_ctrl = self->getChild<LLUICtrl>("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<LLFloaterMFA*>(userdata);
LL_INFOS("MFA") << "User cancels MFA challenge attempt." << LL_ENDL;
if(self->mReplyPumpName != "")

View File

@ -228,6 +228,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> 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<LLSDNotationFormatter>(request_params) << LL_ENDL;

View File

@ -1,42 +1,43 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
title="MFA Token Requred"
legacy_header_height="18"
can_minimize="false"
height="87"
can_close="false"
height="110"
layout="topleft"
name="mfa_challenge"
help_topic="mfa_challenge"
width="480">
<text
type="string"
word_wrap="true"
length="1"
bottom="20"
follows="top|left"
height="15"
layout="topleft"
left="10"
name="token_prompt"
name="token_prompt_text"
top="20">
token prompt
</text>
<text_box
<line_editor
allow_text_entry="true"
follows="left|top|right"
height="19"
layout="topleft"
left_delta="70"
bottom_delta="40"
max_chars="16"
name="token_entry"
top_delta="-4"
width="16" />
name="token_edit"
width="100" />
<button
follows="top|left"
height="20"
label="Continue"
layout="topleft"
left="10"
name="Continue"
top="50"
name="continue_btn"
bottom_delta="30"
width="64" />
<button
follows="top|left"
@ -44,7 +45,7 @@
label="Cancel"
layout="topleft"
left_pad="5"
name="Cancel"
top_delta="0"
name="cancel_btn"
bottom_delta="0"
width="64" />
</floater>