diff --git a/indra/newview/fspanellogin.cpp b/indra/newview/fspanellogin.cpp index 09a45e199d..4ccc60194f 100644 --- a/indra/newview/fspanellogin.cpp +++ b/indra/newview/fspanellogin.cpp @@ -191,6 +191,7 @@ FSPanelLogin::FSPanelLogin(const LLRect &rect, setBackgroundOpaque(true); mPasswordModified = false; + mShowPassword = false; sInstance = this; @@ -316,6 +317,10 @@ FSPanelLogin::FSPanelLogin(const LLRect &rect, username_combo->setFocusLostCallback(boost::bind(&FSPanelLogin::onSelectUser, this)); mPreviousUsername = username_combo->getValue().asString(); + childSetAction("password_show_btn", onShowHidePasswordClick, this); + childSetAction("password_hide_btn", onShowHidePasswordClick, this); + syncShowHidePasswordButton(); + mInitialized = true; } @@ -1058,6 +1063,37 @@ void FSPanelLogin::onClickForgotPassword(void*) } } +// static +void FSPanelLogin::onShowHidePasswordClick(void*) +{ + if (sInstance) + { // mShowPassword is not saved between sessions, it's just for short-term use + sInstance->mShowPassword = !sInstance->mShowPassword; + LL_INFOS("AppInit") << "Showing password text now " << (sInstance->mShowPassword ? "on" : "off") << LL_ENDL; + + sInstance->syncShowHidePasswordButton(); + } +} + + +void FSPanelLogin::syncShowHidePasswordButton() +{ // Show or hide the two 'eye' buttons for password visibility + LLButton* show_password_btn = sInstance->findChild("password_show_btn"); + if (show_password_btn) + { + show_password_btn->setVisible(!mShowPassword); + } + LLButton* hide_password_btn = sInstance->findChild("password_hide_btn"); + if (hide_password_btn) + { + hide_password_btn->setVisible(mShowPassword); + } + + // Update the edit field to replace password text with dots ... or not. Will redraw + sInstance->getChild("password_edit")->setDrawAsterixes(!mShowPassword); +} + + //static void FSPanelLogin::onClickHelp(void*) { diff --git a/indra/newview/fspanellogin.h b/indra/newview/fspanellogin.h index 9a817c0bcf..dc256dbd93 100644 --- a/indra/newview/fspanellogin.h +++ b/indra/newview/fspanellogin.h @@ -98,6 +98,7 @@ private: void onSelectServer(); void onLocationSLURL(); void onUsernameTextChanged(); + void syncShowHidePasswordButton(); // Update which button is shown based on mShowPassword static void onClickConnect(void*); static void onClickNewAccount(void*); @@ -110,6 +111,7 @@ private: static void onRemoveCallback(const LLSD& notification, const LLSD& response); static void onClickGridMgrHelp(void*); static void onClickGridBuilder(void*); + static void onShowHidePasswordClick(void*); static std::string credentialName(); private: @@ -121,6 +123,8 @@ private: void* mCallbackData; bool mPasswordModified; + bool mShowPassword; // Show password in normal text vs. hidden by dots + bool mShowFavorites; static FSPanelLogin* sInstance; diff --git a/indra/newview/skins/default/xui/en/panel_fs_login.xml b/indra/newview/skins/default/xui/en/panel_fs_login.xml index eb071fed6a..45ee5e2890 100644 --- a/indra/newview/skins/default/xui/en/panel_fs_login.xml +++ b/indra/newview/skins/default/xui/en/panel_fs_login.xml @@ -274,6 +274,30 @@ top_pad="1" name="remember_check" width="145" /> +