summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llpanellogin.cpp138
1 files changed, 49 insertions, 89 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 44ff62e290..911ecaad9d 100644..100755
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llpanellogin.h"
+#include "lllayoutstack.h"
#include "indra_constants.h" // for key and mask constants
#include "llfloaterreg.h"
@@ -81,10 +82,6 @@ const S32 MAX_PASSWORD = 16;
LLPanelLogin *LLPanelLogin::sInstance = NULL;
BOOL LLPanelLogin::sCapslockDidNotification = FALSE;
-// 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:
@@ -138,14 +135,17 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mLogoImage = LLUI::getUIImage("startup_logo");
buildFromFile( "panel_login.xml");
-
+
reshape(rect.getWidth(), rect.getHeight());
- getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
+ LLLineEditor* password_edit(getChild<LLLineEditor>("password_edit"));
+ password_edit->setKeystrokeCallback(onPassKey, this);
+ // STEAM-14: When user presses Enter with this field in focus, initiate login
+ password_edit->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this));
// change z sort of clickable text to be behind buttons
sendChildToBack(getChildView("forgot_password_text"));
-
+
LLComboBox* location_combo = getChild<LLComboBox>("start_location_combo");
updateLocationSelectorsVisibility(); // separate so that it can be called from preferences
location_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLocationSLURL, this));
@@ -201,7 +201,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
childSetAction("connect_btn", onClickConnect, this);
- getChild<LLPanel>("login")->setDefaultBtn("connect_btn");
+ getChild<LLPanel>("links_login_panel")->setDefaultBtn("connect_btn");
std::string channel = LLVersionInfo::getChannel();
std::string version = llformat("%s (%d)",
@@ -211,8 +211,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text");
forgot_password_text->setClickedCallback(onClickForgotPassword, NULL);
- LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text");
- create_new_account_text->setClickedCallback(onClickNewAccount, NULL);
+ childSetAction("create_new_account_btn", onClickNewAccount, NULL);
LLTextBox* need_help_text = getChild<LLTextBox>("login_help");
need_help_text->setClickedCallback(onClickHelp, NULL);
@@ -220,14 +219,17 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// get the web browser control
LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html");
web_browser->addObserver(this);
-
+
reshapeBrowser();
loadLoginPage();
-
+
// Show last logged in user favorites in "Start at" combo.
addUsersWithFavoritesToUsername();
- getChild<LLComboBox>("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this));
+ LLComboBox* username_combo(getChild<LLComboBox>("username_combo"));
+ username_combo->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this));
+ // STEAM-14: When user presses Enter with this field in focus, initiate login
+ username_combo->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this));
}
void LLPanelLogin::addUsersWithFavoritesToUsername()
@@ -260,7 +262,6 @@ void LLPanelLogin::addFavoritesToStartLocation()
// Load favorites into the combo.
std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
- std::string canonical_user_name = canonicalize_username(user_defined_name);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
LLSD fav_llsd;
llifstream file;
@@ -273,7 +274,7 @@ void LLPanelLogin::addFavoritesToStartLocation()
// The account name in stored_favorites.xml has Resident last name even if user has
// a single word account name, so it can be compared case-insensitive with the
// user defined "firstname lastname".
- S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
+ S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first);
if (res != 0)
{
lldebugs << "Skipping favorites for " << iter->first << llendl;
@@ -636,12 +637,10 @@ void LLPanelLogin::updateLocationSelectorsVisibility()
if (sInstance)
{
BOOL show_start = gSavedSettings.getBOOL("ShowStartLocation");
- sInstance->getChildView("start_location_combo")->setVisible(show_start);
- sInstance->getChildView("start_location_text")->setVisible(show_start);
+ sInstance->getChild<LLLayoutPanel>("start_location_panel")->setVisible(show_start);
BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
- LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
- server_choice_combo->setVisible( show_server );
+ sInstance->getChild<LLLayoutPanel>("grid_panel")->setVisible(show_server);
}
}
@@ -746,63 +745,48 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh)
void LLPanelLogin::loadLoginPage()
{
if (!sInstance) return;
-
- std::ostringstream oStr;
- std::string login_page = LLGridManager::getInstance()->getLoginPage();
+ LLURI login_page = LLURI(LLGridManager::getInstance()->getLoginPage());
+ LLSD params(login_page.queryMap());
- oStr << login_page;
-
- // Use the right delimeter depending on how LLURI parses the URL
- LLURI login_page_uri = LLURI(login_page);
-
- std::string first_query_delimiter = "&";
- if (login_page_uri.queryMap().size() == 0)
- {
- first_query_delimiter = "?";
- }
+ LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL;
// Language
- std::string language = LLUI::getLanguage();
- oStr << first_query_delimiter<<"lang=" << language;
-
+ params["lang"] = LLUI::getLanguage();
+
// First Login?
if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
{
- oStr << "&firstlogin=TRUE";
+ params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE
}
// Channel and Version
- std::string version = llformat("%s (%d)",
- LLVersionInfo::getShortVersion().c_str(),
- LLVersionInfo::getBuild());
+ params["version"] = llformat("%s (%d)",
+ LLVersionInfo::getShortVersion().c_str(),
+ LLVersionInfo::getBuild());
+ params["channel"] = LLVersionInfo::getChannel();
- char* curl_channel = curl_escape(LLVersionInfo::getChannel().c_str(), 0);
- char* curl_version = curl_escape(version.c_str(), 0);
+ // Grid
+ params["grid"] = LLGridManager::getInstance()->getGridId();
- oStr << "&channel=" << curl_channel;
- oStr << "&version=" << curl_version;
+ // add OS info
+ params["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
- curl_free(curl_channel);
- curl_free(curl_version);
+ // sourceid
+ params["sourceid"] = gSavedSettings.getString("sourceid");
+
+ // Make an LLURI with this augmented info
+ LLURI login_uri(LLURI::buildHTTP(login_page.authority(),
+ login_page.path(),
+ params));
- // Grid
- char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridId().c_str(), 0);
- oStr << "&grid=" << curl_grid;
- curl_free(curl_grid);
-
- // add OS info
- char * os_info = curl_escape(LLAppViewer::instance()->getOSInfo().getOSStringSimple().c_str(), 0);
- oStr << "&os=" << os_info;
- curl_free(os_info);
-
gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
-
+
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
- if (web_browser->getCurrentNavUrl() != oStr.str())
+ if (web_browser->getCurrentNavUrl() != login_uri.asString())
{
- LL_DEBUGS("AppInit")<<oStr.str()<<LL_ENDL;
- web_browser->navigateTo( oStr.str(), "text/html" );
+ LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL;
+ web_browser->navigateTo( login_uri.asString(), "text/html" );
}
}
@@ -886,7 +870,7 @@ void LLPanelLogin::onClickNewAccount(void*)
{
if (sInstance)
{
- LLWeb::loadURLExternal(sInstance->getString("create_account_url"));
+ LLWeb::loadURLExternal(LLTrans::getString("create_account_url"));
}
}
@@ -946,9 +930,11 @@ void LLPanelLogin::updateServer()
// update the login panel links
bool system_grid = LLGridManager::getInstance()->isSystemGrid();
-
- sInstance->getChildView("create_new_account_text")->setVisible( system_grid);
- sInstance->getChildView("forgot_password_text")->setVisible( system_grid);
+
+ // Want to vanish not only create_new_account_btn, but also the
+ // title text over it, so turn on/off the whole layout_panel element.
+ sInstance->getChild<LLLayoutPanel>("links")->setVisible(system_grid);
+ sInstance->getChildView("forgot_password_text")->setVisible(system_grid);
// grid changed so show new splash screen (possibly)
loadLoginPage();
@@ -1021,29 +1007,3 @@ void LLPanelLogin::onLocationSLURL()
LLStartUp::setStartSLURL(location); // calls onUpdateStartSLURL, above
}
-
-
-std::string canonicalize_username(const std::string& name)
-{
- std::string cname = name;
- LLStringUtil::trim(cname);
-
- // 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;
-}