diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2021-12-15 17:01:48 -0800 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2021-12-15 17:05:53 -0800 |
commit | 95e2f6286c140b6d3a7562a7e73f70d0ab60685b (patch) | |
tree | 4edc2eeb6123e7b353f7e1848c6bb54d4ffd7787 | |
parent | ea2ae3769f7edf42d8c3816d9b4bd039f80e4b03 (diff) |
SL-16388 Improvements to llfloatermfa.cpp from code review
-rw-r--r-- | indra/newview/llfloatermfa.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/indra/newview/llfloatermfa.cpp b/indra/newview/llfloatermfa.cpp index 9eff702a46..7710817c23 100644 --- a/indra/newview/llfloatermfa.cpp +++ b/indra/newview/llfloatermfa.cpp @@ -52,14 +52,13 @@ BOOL LLFloaterMFA::postBuild() 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_text"); - token_prompt->setEnabled( FALSE ); - token_prompt->setFocus(TRUE); - token_prompt->setValue(LLSD(mMessage)); - } + // 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; } @@ -68,24 +67,21 @@ BOOL LLFloaterMFA::postBuild() void LLFloaterMFA::onContinue(void* userdata ) { LLFloaterMFA* self = static_cast<LLFloaterMFA*>(userdata); - LL_INFOS("MFA") << "User submits MFA token for challenge." << LL_ENDL; - std::string token; + LLUICtrl *token_ctrl = self->getChild<LLUICtrl>("token_edit"); - if (self->hasChild("token_edit")) - { - // this displays the prompt message - LLUICtrl *token_ctrl = self->getChild<LLUICtrl>("token_edit"); + std::string token(token_ctrl->getValue().asStringRef()); - token = token_ctrl->getValue().asStringRef(); - } - - if(self->mReplyPumpName != "") + if (!token.empty()) { - LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(token)); - } + 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 + self->closeFloater(); // destroys this object + } } // static |