From e50e4b330de05df44274a0afc21e91c0b7bbfced Mon Sep 17 00:00:00 2001 From: Cinders Date: Thu, 29 Aug 2013 15:09:26 -0600 Subject: [PATCH] Fix more merge regressions, update code to use updated UserLoginInfo setting --- indra/newview/app_settings/cmd_line.xml | 41 ++--------------- indra/newview/llloginhandler.cpp | 13 ++++-- indra/newview/llpanellogin.cpp | 61 +++++++++++++++++++++---- indra/newview/llstartup.cpp | 2 +- 4 files changed, 64 insertions(+), 53 deletions(-) diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 8de9362b03..dae66e9ca9 100755 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -177,8 +177,6 @@ UserLogFile - - - login - - desc - 3 tokens: first, last and password - count - 3 - map-to - UserLoginInfo1 - - loginpage @@ -210,20 +197,6 @@ LoginPage - - - loginuri desc @@ -231,9 +204,9 @@ count 1 map-to - CmdLineLoginURI1 + CmdLineLoginURI - + logmetrics desc @@ -464,15 +437,6 @@ 1 - - + diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp index f60ea807f8..5c077f70ce 100755 --- a/indra/newview/llloginhandler.cpp +++ b/indra/newview/llloginhandler.cpp @@ -164,7 +164,12 @@ LLPointer LLLoginHandler::initializeLoginInfo() { LLPointer result = NULL; // so try to load it from the UserLoginInfo - result = loadSavedUserLoginInfo(); + result = loadSavedUserLoginInfo(); + // + //if (result.isNull()) + //{ + // result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + //} return result; } @@ -174,7 +179,7 @@ LLPointer LLLoginHandler::loadSavedUserLoginInfo() { // load the saved user login info into a LLCredential. // perhaps this should be moved. - LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo1"); + LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo"); if (cmd_line_login.size() == 3) { @@ -192,8 +197,8 @@ LLPointer LLLoginHandler::loadSavedUserLoginInfo() authenticator["secret"] = md5pass; // yuck, we'll fix this with mani's changes. gSavedSettings.setBOOL("AutoLogin", TRUE); - return gSecAPIHandler->createCredential(identifier["first_name"].asString()+" "+identifier["last_name"].asString()+"@"+LLGridManager::getInstance()->getGrid(), - identifier, authenticator); + return gSecAPIHandler->createCredential(identifier["first_name"].asString() + " " + identifier["last_name"].asString() + "@" +LLGridManager::getInstance()->getGrid(), + identifier, authenticator); } return NULL; } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a98f0d691a..7ab9e2419f 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -84,6 +84,12 @@ const S32 MAX_PASSWORD = 16; LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; +// We still use this in firestorm... +// Helper for converting a user name into the canonical "Firstname Lastname" form. +// For new accounts without a last name "Resident" is added as a last name. +static std::string canonicalize_username(const std::string& name); +// + class LLLoginRefreshHandler : public LLCommandHandler { public: @@ -325,6 +331,11 @@ void LLPanelLogin::addFavoritesToStartLocation() // Load favorites into the combo. std::string user_defined_name = getChild("username_combo")->getSimple(); +// FIRE-10122 - User@grid stored_favorites.xml + //std::string canonical_user_name = canonicalize_username(user_defined_name); + std::string current_grid = getChild("server_combo")->getSimple(); + std::string current_user = canonicalize_username(user_defined_name) + " @ " + current_grid; +// std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); LLSD fav_llsd; llifstream file; @@ -338,10 +349,8 @@ void LLPanelLogin::addFavoritesToStartLocation() // a single word account name, so it can be compared case-insensitive with the // user defined "firstname lastname". // FIRE-10122 - User@grid stored_favorites.xml - //S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first); 3.6.4 check this new - //S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first); LL old - //S32 res = LLStringUtil::compareInsensitive(current_user, iter->first); FS - S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first); + //S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first); + S32 res = LLStringUtil::compareInsensitive(current_user, iter->first); // if (res != 0) { @@ -579,12 +588,12 @@ void LLPanelLogin::setFields(LLPointer credential) // fill it with MAX_PASSWORD characters so we get a // nice row of asterixes. const std::string filler("123456789!123456"); - sInstance->getChild("password_edit")->setValue(std::string("123456789!123456")); + sInstance->getChild("password_edit")->setValue(filler); remember = true; // } else { - sInstance->getChild("password_edit")->setValue(std::string()); + sInstance->getChild("password_edit")->setValue(std::string()); remember = false; // } sInstance->getChild("remember_check")->setValue(remember); @@ -1149,8 +1158,40 @@ void LLPanelLogin::onLocationSLURL() LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above } +///////////////////////////// +// Firestorm functions // +///////////////////////////// + +std::string canonicalize_username(const std::string& name) +{ + std::string cname = name; + +// Strip off any grid appendage + U32 arobase = cname.find("@"); + if(arobase > 0) + cname = cname.substr(0, arobase - 1); +// + + // determine if the username is a first/last form or not. + size_t separator_index = cname.find_first_of(" ._"); + std::string first = cname.substr(0, separator_index); + std::string last; + if (separator_index != cname.npos) + { + last = cname.substr(separator_index + 1, cname.npos); + LLStringUtil::trim(last); + } + else + { + // ...on Linden grids, single username users as considered to have + // last name "Resident" + last = "Resident"; + } + + // Username in traditional "firstname lastname" form. + return first + ' ' + last; +} -// void LLPanelLogin::addUsersToCombo(BOOL show_server) { LLComboBox* combo = getChild("username_combo"); @@ -1160,7 +1201,7 @@ void LLPanelLogin::addUsersToCombo(BOOL show_server) std::string current_creds=credentialName(); if(current_creds.find("@") < 1) { - current_creds = gSavedSettings.getString("UserLoginInfo"); + current_creds = gSavedSettings.getLLSD("UserLoginInfo").asString(); } std::vector logins = gSecAPIHandler->listCredentials(); @@ -1224,7 +1265,7 @@ void LLPanelLogin::onClickRemove(void*) { LLComboBox* combo = sInstance->getChild("username_combo"); std::string credName = combo->getValue().asString(); - if ( credName == gSavedSettings.getString("UserLoginInfo") ) + if ( credName == gSavedSettings.getLLSD("UserLoginInfo").asString() ) gSavedSettings.getControl("UserLoginInfo")->resetToDefault(); LLPointer credential = gSecAPIHandler->loadCredential(credName); gSecAPIHandler->deleteCredential(credential); @@ -1382,4 +1423,4 @@ void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& n break; } } -// \ No newline at end of file +// diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7772147850..442b547b49 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -955,7 +955,7 @@ bool idle_startup() { LL_DEBUGS("AppInit") << "loading credentials from gLoginHandler" << LL_ENDL; display_startup(); - gUserCredential = gSecAPIHandler->loadCredential(gSavedSettings.getString("UserLoginInfo")); + gUserCredential = gSecAPIHandler->loadCredential(gSavedSettings.getLLSD("UserLoginInfo").asString()); display_startup(); } // Make sure the process dialog doesn't hide things