From 99a4bd23dadbdaf8e82ceca26af531c93d5fd4a6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 9 Aug 2019 21:34:12 +0300 Subject: SL-9699 Login selection --- indra/newview/llpanellogin.cpp | 426 +++++++++++++++++++++++++++++++++-------- 1 file changed, 342 insertions(+), 84 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index e253557797..d7c189271e 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -77,6 +77,60 @@ LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; BOOL LLPanelLogin::sCredentialSet = FALSE; +// Helper functions + +LLPointer load_user_credentials(std::string &user_key) +{ + if (gSecAPIHandler->hasCredentialMap("login_list", LLGridManager::getInstance()->getGrid())) + { + // user_key should be of "name Resident" format + return gSecAPIHandler->loadFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), user_key); + } + else + { + // legacy (or legacy^2, since it also tries to load from settings) + return gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + } +} + +// keys are lower case to be case insensitive so they are not always +// identical to names which retain user input, like: +// "AwEsOmE Resident" -> "awesome_resident" +std::string get_user_key_from_name(const std::string &username) +{ + std::string key = username; + LLStringUtil::trim(key); + LLStringUtil::toLower(key); + if (!LLGridManager::getInstance()->isSystemGrid()) + { + size_t separator_index = username.find_first_of(" "); + if (separator_index == username.npos) + { + // CRED_IDENTIFIER_TYPE_ACCOUNT + return key; + } + } + // CRED_IDENTIFIER_TYPE_AGENT + size_t separator_index = username.find_first_of(" ._"); + std::string first = username.substr(0, separator_index); + std::string last; + if (separator_index != username.npos) + { + last = username.substr(separator_index + 1, username.npos); + LLStringUtil::trim(last); + } + else + { + // ...on Linden grids, single username users as considered to have + // last name "Resident" + // *TODO: Make login.cgi support "account_name" like above + last = "resident"; + } + + key = first + "_" + last; + return key; +} + class LLLoginLocationAutoHandler : public LLCommandHandler { public: @@ -168,6 +222,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, mCallback(callback), mCallbackData(cb_data), mListener(new LLPanelLoginListener(this)), + mFirstLoginThisInstall(gSavedSettings.getBOOL("FirstLoginThisInstall")), mUsernameLength(0), mPasswordLength(0), mLocationLength(0), @@ -186,7 +241,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, login_holder->addChild(this); } - if (gSavedSettings.getBOOL("FirstLoginThisInstall")) + if (mFirstLoginThisInstall) { buildFromFile( "panel_login_first.xml"); } @@ -206,35 +261,39 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, sendChildToBack(getChildView("forgot_password_text")); sendChildToBack(getChildView("sign_up_text")); - LLComboBox* favorites_combo = getChild("start_location_combo"); - updateLocationSelectorsVisibility(); // separate so that it can be called from preferences - favorites_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); - favorites_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); - - LLComboBox* server_choice_combo = getChild("server_combo"); - server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); - - // Load all of the grids, sorted, and then add a bar and the current grid at the top - server_choice_combo->removeall(); - - std::string current_grid = LLGridManager::getInstance()->getGrid(); - std::map known_grids = LLGridManager::getInstance()->getKnownGrids(); - for (std::map::iterator grid_choice = known_grids.begin(); - grid_choice != known_grids.end(); - grid_choice++) - { - if (!grid_choice->first.empty() && current_grid != grid_choice->first) - { - LL_DEBUGS("AppInit")<<"adding "<first<add(grid_choice->second, grid_choice->first); - } - } - server_choice_combo->sortByName(); - LL_DEBUGS("AppInit")<<"adding current "<add(LLGridManager::getInstance()->getGridLabel(), - current_grid, - ADD_TOP); - server_choice_combo->selectFirstItem(); + std::string current_grid = LLGridManager::getInstance()->getGrid(); + if (!mFirstLoginThisInstall) + { + LLComboBox* favorites_combo = getChild("start_location_combo"); + updateLocationSelectorsVisibility(); // separate so that it can be called from preferences + favorites_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); + favorites_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this)); + + LLComboBox* server_choice_combo = getChild("server_combo"); + server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectServer, this)); + + // Load all of the grids, sorted, and then add a bar and the current grid at the top + server_choice_combo->removeall(); + + std::map known_grids = LLGridManager::getInstance()->getKnownGrids(); + for (std::map::iterator grid_choice = known_grids.begin(); + grid_choice != known_grids.end(); + grid_choice++) + { + if (!grid_choice->first.empty() && current_grid != grid_choice->first) + { + LL_DEBUGS("AppInit") << "adding " << grid_choice->first << LL_ENDL; + server_choice_combo->add(grid_choice->second, grid_choice->first); + } + } + server_choice_combo->sortByName(); + + LL_DEBUGS("AppInit") << "adding current " << current_grid << LL_ENDL; + server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), + current_grid, + ADD_TOP); + server_choice_combo->selectFirstItem(); + } LLSLURL start_slurl(LLStartUp::getStartSLURL()); // The StartSLURL might have been set either by an explicit command-line @@ -297,14 +356,30 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, loadLoginPage(); LLComboBox* username_combo(getChild("username_combo")); - username_combo->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this)); + username_combo->setTextChangedCallback(boost::bind(&LLPanelLogin::onUserNameTextEnty, this)); // STEAM-14: When user presses Enter with this field in focus, initiate login - username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); + username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onUserListCommit, this)); + username_combo->setReturnCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); username_combo->setKeystrokeOnEsc(TRUE); + + if (!mFirstLoginThisInstall) + { + LLCheckBoxCtrl* remember_name = getChild("remember_name"); + remember_name->setCommitCallback(boost::bind(&LLPanelLogin::onRememberUserCheck, this)); + } } void LLPanelLogin::addFavoritesToStartLocation() { + if (mFirstLoginThisInstall) + { + // first login panel has no favorites, just update name length and buttons + std::string user_defined_name = getChild("username_combo")->getSimple(); + mUsernameLength = user_defined_name.length(); + updateLoginButtons(); + return; + } + // Clear the combo. LLComboBox* combo = getChild("start_location_combo"); if (!combo) return; @@ -316,14 +391,14 @@ void LLPanelLogin::addFavoritesToStartLocation() // Load favorites into the combo. std::string user_defined_name = getChild("username_combo")->getSimple(); + LLStringUtil::trim(user_defined_name); LLStringUtil::toLower(user_defined_name); - std::replace(user_defined_name.begin(), user_defined_name.end(), '.', ' '); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); mUsernameLength = user_defined_name.length(); updateLoginButtons(); - std::string::size_type index = user_defined_name.find(' '); + std::string::size_type index = user_defined_name.find_first_of(" ._"); if (index != std::string::npos) { std::string username = user_defined_name.substr(0, index); @@ -332,6 +407,10 @@ void LLPanelLogin::addFavoritesToStartLocation() { user_defined_name = username; } + else + { + user_defined_name = username + " " + lastname; + } } LLSD fav_llsd; @@ -442,24 +521,6 @@ void LLPanelLogin::giveFocus() } } -// static -void LLPanelLogin::showLoginWidgets() -{ - if (sInstance) - { - // *NOTE: Mani - This may or may not be obselete code. - // It seems to be part of the defunct? reg-in-client project. - sInstance->getChildView("login_widgets")->setVisible( true); - LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - - // *TODO: Append all the usual login parameters, like first_login=Y etc. - std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage(); - web_browser->navigateTo( splash_screen_url, "text/html" ); - LLUICtrl* username_combo = sInstance->getChild("username_combo"); - username_combo->setFocus(TRUE); - } -} - // static void LLPanelLogin::show(const LLRect &rect, void (*callback)(S32 option, void* user_data), @@ -480,9 +541,55 @@ void LLPanelLogin::show(const LLRect &rect, gFocusMgr.setDefaultKeyboardFocus(sInstance); } +//static +void LLPanelLogin::populateFields(LLPointer credential, bool remember_user, bool remember_psswrd) +{ + if (!sInstance) + { + LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; + return; + } + LLUICtrl* remember_check = sInstance->getChild("remember_check"); + remember_check->setValue(remember_psswrd); + if (sInstance->mFirstLoginThisInstall) + { + // no list to populate + setFields(credential, remember_psswrd); + } + else + { + sInstance->getChild("remember_name")->setValue(remember_user); + sInstance->populateUserList(credential, remember_psswrd); + remember_check->setEnabled(remember_user); + } +} + +//static +void LLPanelLogin::resetFields() +{ + if (!sInstance) + { + // class not existing at this point might happen since this + // function is used to reset list in case of changes by external sources + return; + } + if (sInstance->mFirstLoginThisInstall) + { + // no list to populate + LL_WARNS() << "Shouldn't happen, user should have no ability to modify list on first install" << LL_ENDL; + } + else + { + LLUICtrl* remember_check = sInstance->getChild("remember_check"); + bool remember_psswrd = remember_check->getValue(); + LLPointer cred = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + sInstance->populateUserList(cred, remember_psswrd); + } +} + // static void LLPanelLogin::setFields(LLPointer credential, - BOOL remember) + bool remember_psswrd) { if (!sInstance) { @@ -492,13 +599,15 @@ void LLPanelLogin::setFields(LLPointer credential, sCredentialSet = TRUE; LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL; - LLSD identifier = credential->getIdentifier(); - if((std::string)identifier["type"] == "agent") + LLSD identifier = credential.notNull() ? credential->getIdentifier() : LLSD(); + + if(identifier.has("type") && (std::string)identifier["type"] == "agent") { + // not nessesary for panel_login.xml, needed for panel_login_first.xml std::string firstname = identifier["first_name"].asString(); std::string lastname = identifier["last_name"].asString(); std::string login_id = firstname; - if (!lastname.empty() && lastname != "Resident") + if (!lastname.empty() && lastname != "Resident" && lastname != "resident") { // support traditional First Last name SLURLs login_id += " "; @@ -506,22 +615,23 @@ void LLPanelLogin::setFields(LLPointer credential, } sInstance->getChild("username_combo")->setLabel(login_id); } - else if((std::string)identifier["type"] == "account") + else if(identifier.has("type") && (std::string)identifier["type"] == "account") { sInstance->getChild("username_combo")->setLabel((std::string)identifier["account_name"]); } else { - sInstance->getChild("username_combo")->setLabel(std::string()); + sInstance->getChild("username_combo")->setLabel(std::string()); } + sInstance->addFavoritesToStartLocation(); // if the password exists in the credential, set the password field with // a filler to get some stars - LLSD authenticator = credential->getAuthenticator(); + LLSD authenticator = credential.notNull() ? credential->getAuthenticator() : LLSD(); LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL; if(authenticator.isMap() && authenticator.has("secret") && - (authenticator["secret"].asString().size() > 0) && remember) + (authenticator["secret"].asString().size() > 0) && remember_psswrd) { // This is a MD5 hex digest of a password. @@ -537,36 +647,25 @@ void LLPanelLogin::setFields(LLPointer credential, { sInstance->getChild("password_edit")->setValue(std::string()); } - sInstance->getChild("remember_check")->setValue(remember); } - // static void LLPanelLogin::getFields(LLPointer& credential, - BOOL& remember) + bool& remember_user, + bool& remember_psswrd) { if (!sInstance) { LL_WARNS() << "Attempted getFields with no login view shown" << LL_ENDL; return; } - - // load the credential so we can pass back the stored password or hash if the user did - // not modify the password field. - - credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); LLSD identifier = LLSD::emptyMap(); LLSD authenticator = LLSD::emptyMap(); - - if(credential.notNull()) - { - authenticator = credential->getAuthenticator(); - } - std::string username = sInstance->getChild("username_combo")->getValue().asString(); - LLStringUtil::trim(username); + std::string username = sInstance->getChild("username_combo")->getValue().asString(); std::string password = sInstance->getChild("password_edit")->getValue().asString(); + LLStringUtil::trim(username); LL_INFOS("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL; // determine if the username is a first/last form or not. @@ -586,6 +685,14 @@ void LLPanelLogin::getFields(LLPointer& credential, authenticator["type"] = CRED_AUTHENTICATOR_TYPE_CLEAR; authenticator["secret"] = password; } + else + { + credential = load_user_credentials(username); + if (credential.notNull()) + { + authenticator = credential->getAuthenticator(); + } + } } else { @@ -597,7 +704,7 @@ void LLPanelLogin::getFields(LLPointer& credential, if (separator_index != username.npos) { last = username.substr(separator_index+1, username.npos); - LLStringUtil::trim(last); + LLStringUtil::trim(last); } else { @@ -625,10 +732,28 @@ void LLPanelLogin::getFields(LLPointer& credential, pass.hex_digest(md5pass); authenticator["secret"] = md5pass; } + else + { + std::string key = first + "_" + last; + LLStringUtil::toLower(key); + credential = load_user_credentials(key); + if (credential.notNull()) + { + authenticator = credential->getAuthenticator(); + } + } } } credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator); - remember = sInstance->getChild("remember_check")->getValue(); + remember_psswrd = sInstance->getChild("remember_check")->getValue(); + if (!sInstance->mFirstLoginThisInstall) + { + remember_user = sInstance->getChild("remember_name")->getValue(); + } + else + { + remember_user = true; + } } @@ -898,8 +1023,8 @@ void LLPanelLogin::onClickConnect(void *) { sCredentialSet = FALSE; LLPointer cred; - BOOL remember; - getFields(cred, remember); + bool remember_1, remember_2; + getFields(cred, remember_1, remember_2); std::string identifier_type; cred->identifierType(identifier_type); LLSD allowed_credential_types; @@ -952,6 +1077,57 @@ void LLPanelLogin::onClickSignUp(void*) } } +// static +void LLPanelLogin::onUserNameTextEnty(void*) +{ + sInstance->mPasswordModified = true; + sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->addFavoritesToStartLocation(); //will call updateLoginButtons() +} + +// static +void LLPanelLogin::onUserListCommit(void*) +{ + if (sInstance) + { + LLComboBox* username_combo(sInstance->getChild("username_combo")); + static S32 ind = -1; + if (ind != username_combo->getCurrentIndex()) + { + std::string user_key = username_combo->getSelectedValue(); + LLPointer cred = gSecAPIHandler->loadFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), user_key); + bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); + setFields(cred, remember_psswrd); + sInstance->mPasswordModified = false; + } + else + { + std::string pass = sInstance->getChild("password_edit")->getValue().asString(); + if (pass.empty()) + { + sInstance->giveFocus(); + } + else + { + onClickConnect(NULL); + } + } + } +} + +// static +void LLPanelLogin::onRememberUserCheck(void*) +{ + if (sInstance) + { + LLCheckBoxCtrl* remember_name(sInstance->getChild("remember_name")); + LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_check")); + + bool remember = remember_name->getValue().asBoolean(); + remember_psswrd->setEnabled(remember); + } +} + // static void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) { @@ -979,9 +1155,11 @@ void LLPanelLogin::updateServer() // for that grid and set them to the UI. if(!sInstance->areCredentialFieldsDirty()) { - LLPointer credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - bool remember = sInstance->getChild("remember_check")->getValue(); - sInstance->setFields(credential, remember); + // populate dropbox and setFields + bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); + // Note: following call is related to initializeLoginInfo() + LLPointer credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + sInstance->populateUserList(credential, remember_psswrd); } // update the login panel links @@ -1011,14 +1189,63 @@ void LLPanelLogin::updateLoginButtons() LLButton* login_btn = getChild("connect_btn"); login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0); + + if (!mFirstLoginThisInstall) + { + LLComboBox* user_combo = getChild("username_combo"); + LLCheckBoxCtrl* remember_name = getChild("remember_name"); + remember_name->setEnabled(user_combo->getCurrentIndex() == -1); + } +} + +void LLPanelLogin::populateUserList(LLPointer credential, bool remember_psswrd) +{ + LLComboBox* user_combo = getChild("username_combo"); + user_combo->removeall(); + user_combo->clear(); + + if (gSecAPIHandler->hasCredentialMap("login_list", LLGridManager::getInstance()->getGrid())) + { + LLSecAPIHandler::credential_map_t credencials; + gSecAPIHandler->loadCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), credencials); + + LLSecAPIHandler::credential_map_t::iterator cr_iter = credencials.begin(); + LLSecAPIHandler::credential_map_t::iterator cr_end = credencials.end(); + while (cr_iter != cr_end) + { + if (cr_iter->second.notNull()) // basic safety in case of future changes + { + // cr_iter->first == user_id , to be able to be find it in case we select it + user_combo->add(LLPanelLogin::getUserName(cr_iter->second), cr_iter->first, ADD_BOTTOM, TRUE); + } + cr_iter++; + } + + if (credential.isNull() || !user_combo->setSelectedByValue(LLSD(credential->userID()), true)) + { + // selection failed, just deselect whatever might be selected + user_combo->setValue(std::string()); + } + else + { + setFields(credential, remember_psswrd); + } + } + else + { + if (credential.notNull()) + { + user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); + setFields(credential, remember_psswrd); + } + } } + void LLPanelLogin::onSelectServer() { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. - LLPointer credential; - LLComboBox* server_combo = getChild("server_combo"); LLSD server_combo_val = server_combo->getSelectedValue(); LL_INFOS("AppInit") << "grid "< &cred) +{ + if (cred.isNull()) + { + return "unknown"; + } + const LLSD &ident = cred->getIdentifier(); + + if (!ident.isMap()) + { + return "unknown"; + } + else if ((std::string)ident["type"] == "agent") + { + std::string second_name = ident["last_name"]; + if (second_name == "resident" || second_name == "Resident") + { + return (std::string)ident["first_name"]; + } + return (std::string)ident["first_name"] + " " + (std::string)ident["last_name"]; + } + else if ((std::string)ident["type"] == "account") + { + return LLCacheName::cleanFullName((std::string)ident["account_name"]); + } + + return "unknown"; +} + -- cgit v1.3 From f9fdae67789c87ad2a6a062570236b5140ccc112 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 13 Nov 2019 12:56:07 +0200 Subject: SL-9699 Field should be populated as long as there is data, regardless of 'remember password' --- indra/newview/llpanellogin.cpp | 25 ++++++++++--------------- indra/newview/llpanellogin.h | 4 ++-- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index d7c189271e..4f050a9748 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -554,12 +554,12 @@ void LLPanelLogin::populateFields(LLPointer credential, bool remem if (sInstance->mFirstLoginThisInstall) { // no list to populate - setFields(credential, remember_psswrd); + setFields(credential); } else { sInstance->getChild("remember_name")->setValue(remember_user); - sInstance->populateUserList(credential, remember_psswrd); + sInstance->populateUserList(credential); remember_check->setEnabled(remember_user); } } @@ -580,16 +580,13 @@ void LLPanelLogin::resetFields() } else { - LLUICtrl* remember_check = sInstance->getChild("remember_check"); - bool remember_psswrd = remember_check->getValue(); LLPointer cred = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - sInstance->populateUserList(cred, remember_psswrd); + sInstance->populateUserList(cred); } } // static -void LLPanelLogin::setFields(LLPointer credential, - bool remember_psswrd) +void LLPanelLogin::setFields(LLPointer credential) { if (!sInstance) { @@ -631,7 +628,7 @@ void LLPanelLogin::setFields(LLPointer credential, LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL; if(authenticator.isMap() && authenticator.has("secret") && - (authenticator["secret"].asString().size() > 0) && remember_psswrd) + (authenticator["secret"].asString().size() > 0)) { // This is a MD5 hex digest of a password. @@ -1096,8 +1093,7 @@ void LLPanelLogin::onUserListCommit(void*) { std::string user_key = username_combo->getSelectedValue(); LLPointer cred = gSecAPIHandler->loadFromCredentialMap("login_list", LLGridManager::getInstance()->getGrid(), user_key); - bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); - setFields(cred, remember_psswrd); + setFields(cred); sInstance->mPasswordModified = false; } else @@ -1156,10 +1152,9 @@ void LLPanelLogin::updateServer() if(!sInstance->areCredentialFieldsDirty()) { // populate dropbox and setFields - bool remember_psswrd = sInstance->getChild("remember_check")->getValue(); // Note: following call is related to initializeLoginInfo() LLPointer credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); - sInstance->populateUserList(credential, remember_psswrd); + sInstance->populateUserList(credential); } // update the login panel links @@ -1198,7 +1193,7 @@ void LLPanelLogin::updateLoginButtons() } } -void LLPanelLogin::populateUserList(LLPointer credential, bool remember_psswrd) +void LLPanelLogin::populateUserList(LLPointer credential) { LLComboBox* user_combo = getChild("username_combo"); user_combo->removeall(); @@ -1228,7 +1223,7 @@ void LLPanelLogin::populateUserList(LLPointer credential, bool rem } else { - setFields(credential, remember_psswrd); + setFields(credential); } } else @@ -1236,7 +1231,7 @@ void LLPanelLogin::populateUserList(LLPointer credential, bool rem if (credential.notNull()) { user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); - setFields(credential, remember_psswrd); + setFields(credential); } } } diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 3eb7b68949..c9b8e1b6fc 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -96,7 +96,7 @@ private: void onSelectServer(); void onLocationSLURL(); - static void setFields(LLPointer credential, bool remember_psswrd); + static void setFields(LLPointer credential); static void onClickConnect(void*); static void onClickNewAccount(void*); @@ -113,7 +113,7 @@ private: boost::scoped_ptr mListener; void updateLoginButtons(); - void populateUserList(LLPointer credential, bool remember_psswrd); + void populateUserList(LLPointer credential); void (*mCallback)(S32 option, void *userdata); void* mCallbackData; -- cgit v1.3 From 75d910062546eedd609a4cb751bc707cbdd3eac8 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 15 Nov 2019 19:47:03 +0200 Subject: SL-9699 First login panel checkbox was misinterpreted --- indra/newview/llpanellogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4f050a9748..cfd486f7f3 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -749,7 +749,7 @@ void LLPanelLogin::getFields(LLPointer& credential, } else { - remember_user = true; + remember_user = remember_psswrd; // on panel_login_first "remember_check" is named as 'remember me' } } -- cgit v1.3 From e32a2e2f8ad072408cb9136d3d5fc5f02a232bef Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Sun, 17 Nov 2019 18:21:49 +0200 Subject: SL-9699 Fixed processing of placeholder --- indra/newview/llpanellogin.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cfd486f7f3..4fd39d1211 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1230,8 +1230,12 @@ void LLPanelLogin::populateUserList(LLPointer credential) { if (credential.notNull()) { - user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); - setFields(credential); + const LLSD &ident = credential->getIdentifier(); + if (ident.isMap() && ident.has("type")) + { + user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); + setFields(credential); + } } } } -- cgit v1.3 From 37ca582a2dacfbe7cbb37d2e9ecddca0a9bc8ed7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 3 Jan 2020 20:12:46 +0200 Subject: SL-9699 Do not disable 'remember me' checkbox --- indra/newview/llpanellogin.cpp | 26 +++++++++++++++------- .../newview/skins/default/xui/en/notifications.xml | 8 +++++++ 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4fd39d1211..00172277bc 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -560,7 +560,6 @@ void LLPanelLogin::populateFields(LLPointer credential, bool remem { sInstance->getChild("remember_name")->setValue(remember_user); sInstance->populateUserList(credential); - remember_check->setEnabled(remember_user); } } @@ -1112,14 +1111,22 @@ void LLPanelLogin::onUserListCommit(void*) } // static +// At the moment only happens if !mFirstLoginThisInstall void LLPanelLogin::onRememberUserCheck(void*) { - if (sInstance) + if (sInstance && !sInstance->mFirstLoginThisInstall) { LLCheckBoxCtrl* remember_name(sInstance->getChild("remember_name")); LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_check")); + LLComboBox* user_combo(sInstance->getChild("username_combo")); bool remember = remember_name->getValue().asBoolean(); + if (user_combo->getCurrentIndex() != -1 && !remember) + { + remember = true; + remember_name->setValue(true); + LLNotificationsUtil::add("LoginCantRemoveUsername"); + } remember_psswrd->setEnabled(remember); } } @@ -1185,12 +1192,15 @@ void LLPanelLogin::updateLoginButtons() login_btn->setEnabled(mUsernameLength != 0 && mPasswordLength != 0); - if (!mFirstLoginThisInstall) - { - LLComboBox* user_combo = getChild("username_combo"); - LLCheckBoxCtrl* remember_name = getChild("remember_name"); - remember_name->setEnabled(user_combo->getCurrentIndex() == -1); - } + if (!mFirstLoginThisInstall) + { + LLComboBox* user_combo = getChild("username_combo"); + LLCheckBoxCtrl* remember_name = getChild("remember_name"); + if (user_combo->getCurrentIndex() != -1) + { + remember_name->setValue(true); + } // Note: might be good idea to do "else remember_name->setValue(mRememberedState)" but it might behave 'weird' to user + } } void LLPanelLogin::populateUserList(LLPointer credential) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 669d6a40c6..70f3139488 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3550,6 +3550,14 @@ If this is your first time using [SECOND_LIFE], you will need to create an accou yestext="Create Account..."/> + + fail +Already remembered user can be forgotten from Me > Preferences > Advanced > Remembered Usernames. + + Date: Thu, 9 Jan 2020 03:05:00 +0200 Subject: SL-12533 Switching between grids on login page does not always switch the remembered user list --- indra/newview/llpanellogin.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 00172277bc..2cc5ea72d6 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -762,11 +762,8 @@ BOOL LLPanelLogin::areCredentialFieldsDirty() } else { - std::string username = sInstance->getChild("username_combo")->getValue().asString(); - LLStringUtil::trim(username); - std::string password = sInstance->getChild("password_edit")->getValue().asString(); LLComboBox* combo = sInstance->getChild("username_combo"); - if(combo && combo->isDirty()) + if (combo && combo->getCurrentIndex() == -1 && combo->isDirty()) { return true; } @@ -1155,8 +1152,30 @@ void LLPanelLogin::updateServer() try { // if they've selected another grid, we should load the credentials - // for that grid and set them to the UI. - if(!sInstance->areCredentialFieldsDirty()) + // for that grid and set them to the UI. But if there were any modifications to + // fields, modifications should carry over. + // Not sure if it should carry over password but it worked like this before login changes + // Example: you started typing in and found that your are under wrong grid, + // you switch yet don't lose anything + if (sInstance->areCredentialFieldsDirty()) + { + // save modified creds + LLComboBox* user_combo = sInstance->getChild("username_combo"); + LLLineEditor* pswd_edit = sInstance->getChild("password_edit"); + std::string username = user_combo->getSimple(); + LLStringUtil::trim(username); + std::string password = pswd_edit->getValue().asString(); + + // populate dropbox and setFields + // Note: following call is related to initializeLoginInfo() + LLPointer credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + sInstance->populateUserList(credential); + + // restore creds + user_combo->setTextEntry(username); + pswd_edit->setValue(password); + } + else { // populate dropbox and setFields // Note: following call is related to initializeLoginInfo() -- cgit v1.3 From 5d4c7195e8ee9a2bc0ee7ac39dbd4186d0784e7c Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 9 Jan 2020 03:23:52 +0200 Subject: SL-12533 Correct password drop and fixed 'dirty' condition --- indra/newview/llpanellogin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 2cc5ea72d6..4edcf4a47d 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -763,7 +763,7 @@ BOOL LLPanelLogin::areCredentialFieldsDirty() else { LLComboBox* combo = sInstance->getChild("username_combo"); - if (combo && combo->getCurrentIndex() == -1 && combo->isDirty()) + if (combo && combo->getCurrentIndex() == -1 && !combo->getValue().asString().empty()) { return true; } @@ -1249,6 +1249,7 @@ void LLPanelLogin::populateUserList(LLPointer credential) { // selection failed, just deselect whatever might be selected user_combo->setValue(std::string()); + getChild("password_edit")->setValue(std::string()); } else { -- cgit v1.3 From 94d718c15002b0c3e99ac14bad8379bde81d36f0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 13 Jan 2020 19:46:10 +0200 Subject: SL-12556 Fixed The ‘Log In’ button being active with empty fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- indra/newview/llpanellogin.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 4edcf4a47d..dd4ca261ff 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -609,15 +609,19 @@ void LLPanelLogin::setFields(LLPointer credential) login_id += " "; login_id += lastname; } - sInstance->getChild("username_combo")->setLabel(login_id); + sInstance->getChild("username_combo")->setLabel(login_id); + sInstance->mUsernameLength = login_id.length(); } else if(identifier.has("type") && (std::string)identifier["type"] == "account") { - sInstance->getChild("username_combo")->setLabel((std::string)identifier["account_name"]); + std::string login_id = identifier["account_name"].asString(); + sInstance->getChild("username_combo")->setLabel(login_id); + sInstance->mUsernameLength = login_id.length(); } else { - sInstance->getChild("username_combo")->setLabel(std::string()); + sInstance->getChild("username_combo")->setLabel(std::string()); + sInstance->mUsernameLength = 0; } sInstance->addFavoritesToStartLocation(); @@ -641,7 +645,8 @@ void LLPanelLogin::setFields(LLPointer credential) } else { - sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->mPasswordLength = 0; } } @@ -1250,6 +1255,9 @@ void LLPanelLogin::populateUserList(LLPointer credential) // selection failed, just deselect whatever might be selected user_combo->setValue(std::string()); getChild("password_edit")->setValue(std::string()); + mUsernameLength = 0; + mPasswordLength = 0; + updateLoginButtons(); } else { -- cgit v1.3 From 3233dfe833050cbd0a7d17f4f87a46bcffc1da52 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 13 Jan 2020 21:16:39 +0200 Subject: SL-12555 Fixed Login failed with credencials after the first incorrect entry --- indra/newview/llpanellogin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index dd4ca261ff..2b84d87e53 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -664,7 +664,7 @@ void LLPanelLogin::getFields(LLPointer& credential, LLSD identifier = LLSD::emptyMap(); LLSD authenticator = LLSD::emptyMap(); - std::string username = sInstance->getChild("username_combo")->getValue().asString(); + std::string username = sInstance->getChild("username_combo")->getSimple(); std::string password = sInstance->getChild("password_edit")->getValue().asString(); LLStringUtil::trim(username); -- cgit v1.3 From c83536f6c3950c21836f276f93d8538e67eac9b0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 16 Jan 2020 15:23:38 +0200 Subject: SL-12556 Fixed another case of login button being active --- indra/newview/llpanellogin.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 2b84d87e53..cfa935cd01 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1232,6 +1232,8 @@ void LLPanelLogin::populateUserList(LLPointer credential) LLComboBox* user_combo = getChild("username_combo"); user_combo->removeall(); user_combo->clear(); + mUsernameLength = 0; + mPasswordLength = 0; if (gSecAPIHandler->hasCredentialMap("login_list", LLGridManager::getInstance()->getGrid())) { @@ -1255,8 +1257,6 @@ void LLPanelLogin::populateUserList(LLPointer credential) // selection failed, just deselect whatever might be selected user_combo->setValue(std::string()); getChild("password_edit")->setValue(std::string()); - mUsernameLength = 0; - mPasswordLength = 0; updateLoginButtons(); } else @@ -1274,6 +1274,14 @@ void LLPanelLogin::populateUserList(LLPointer credential) user_combo->add(LLPanelLogin::getUserName(credential), credential->userID(), ADD_BOTTOM, TRUE); setFields(credential); } + else + { + updateLoginButtons(); + } + } + else + { + updateLoginButtons(); } } } -- cgit v1.3 From c5be566a6fbf121d1ca140586a02cda18f83b11b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 20 Jan 2020 14:43:48 +0200 Subject: SL-12596 Fixed incorectly enabled checkbox and enabled login button --- indra/newview/llpanellogin.cpp | 15 +++++++++++---- indra/newview/skins/default/xui/en/panel_login.xml | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanellogin.cpp') diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cfa935cd01..7ef3685cdb 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -549,16 +549,19 @@ void LLPanelLogin::populateFields(LLPointer credential, bool remem LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; return; } - LLUICtrl* remember_check = sInstance->getChild("remember_check"); - remember_check->setValue(remember_psswrd); if (sInstance->mFirstLoginThisInstall) { + LLUICtrl* remember_check = sInstance->getChild("remember_check"); + remember_check->setValue(remember_psswrd); // no list to populate setFields(credential); } else { sInstance->getChild("remember_name")->setValue(remember_user); + LLUICtrl* remember_password = sInstance->getChild("remember_password"); + remember_password->setValue(remember_psswrd); + remember_password->setEnabled(remember_user); sInstance->populateUserList(credential); } } @@ -746,13 +749,14 @@ void LLPanelLogin::getFields(LLPointer& credential, } } credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator); - remember_psswrd = sInstance->getChild("remember_check")->getValue(); if (!sInstance->mFirstLoginThisInstall) { + remember_psswrd = sInstance->getChild("remember_password")->getValue(); remember_user = sInstance->getChild("remember_name")->getValue(); } else { + remember_psswrd = sInstance->getChild("remember_check")->getValue(); remember_user = remember_psswrd; // on panel_login_first "remember_check" is named as 'remember me' } } @@ -1080,6 +1084,7 @@ void LLPanelLogin::onUserNameTextEnty(void*) { sInstance->mPasswordModified = true; sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->mPasswordLength = 0; sInstance->addFavoritesToStartLocation(); //will call updateLoginButtons() } @@ -1119,7 +1124,7 @@ void LLPanelLogin::onRememberUserCheck(void*) if (sInstance && !sInstance->mFirstLoginThisInstall) { LLCheckBoxCtrl* remember_name(sInstance->getChild("remember_name")); - LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_check")); + LLCheckBoxCtrl* remember_psswrd(sInstance->getChild("remember_password")); LLComboBox* user_combo(sInstance->getChild("username_combo")); bool remember = remember_name->getValue().asBoolean(); @@ -1179,6 +1184,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); + sInstance->mUsernameLength = username.length(); + sInstance->mPasswordLength = password.length(); } else { diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 9da0c815ed..eab53c9985 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -151,7 +151,7 @@ label_text.word_wrap="true" label_text.width="150" check_button.bottom="3" - name="remember_check" + name="remember_password" width="170" />