summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rw-r--r--indra/newview/llpanellogin.cpp542
1 files changed, 334 insertions, 208 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index ee4dcc44fe..42e4b397db 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -51,11 +51,12 @@
#include "llfocusmgr.h"
#include "lllineeditor.h"
#include "llnotificationsutil.h"
+#include "llsecapi.h"
#include "llstartup.h"
#include "lltextbox.h"
#include "llui.h"
#include "lluiconstants.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
#include "llversioninfo.h"
#include "llviewerhelp.h"
#include "llviewertexturelist.h"
@@ -77,6 +78,7 @@
#pragma warning(disable: 4355) // 'this' used in initializer list
#endif // LL_WINDOWS
+#include "llsdserialize.h"
#define USE_VIEWER_AUTH 0
const S32 BLACK_BORDER_HEIGHT = 160;
@@ -104,7 +106,6 @@ public:
LLLoginRefreshHandler gLoginRefreshHandler;
-
// helper class that trys to download a URL from a web site and calls a method
// on parent class indicating if the web server is working or not
class LLIamHereLogin : public LLHTTPClient::Responder
@@ -153,10 +154,6 @@ namespace {
boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
};
-void set_start_location(LLUICtrl* ctrl, void* data)
-{
- LLURLSimString::setString(ctrl->getValue().asString());
-}
//---------------------------------------------------------------------------
// Public methods
@@ -187,6 +184,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
delete LLPanelLogin::sInstance;
}
+ mPasswordModified = FALSE;
LLPanelLogin::sInstance = this;
// add to front so we are the bottom-most child
@@ -213,10 +211,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
}
#if !USE_VIEWER_AUTH
- childSetPrevalidate("first_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
- childSetPrevalidate("last_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
-
- childSetCommitCallback("password_edit", mungePassword, this);
+ childSetPrevalidate("username_edit", LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
// change z sort of clickable text to be behind buttons
@@ -228,27 +223,19 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
- std::string sim_string = LLURLSimString::sInstance.mSimString;
- if(sim_string.empty())
- {
- LLURLSimString::setString(gSavedSettings.getString("LoginLocation"));
- sim_string = LLURLSimString::sInstance.mSimString;
- }
-
- if (!sim_string.empty())
+ if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
{
- // Replace "<Type region name>" with this region name
- combo->remove(2);
- combo->add( sim_string );
- combo->setTextEntry(sim_string);
- combo->setCurrentByIndex( 2 );
+ LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
+ LLStartUp::setStartSLURL(slurl);
}
-
- combo->setCommitCallback( &set_start_location, NULL );
+ updateLocationCombo(false);
+
+ combo->setCommitCallback(onSelectLocation, NULL);
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->setCommitCallback(onSelectServer, NULL);
server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1));
+ updateServerCombo();
childSetAction("connect_btn", onClickConnect, this);
@@ -304,17 +291,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
- std::string login_page = gSavedSettings.getString("LoginPage");
- if (login_page.empty())
- {
- login_page = getString( "real_url" );
- }
- LLHTTPClient::head( login_page, gResponsePtr );
-#if !USE_VIEWER_AUTH
- // Initialize visibility (and don't force visibility - use prefs)
- refreshLocation( false );
-#endif
+ LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
+
+ updateLocationCombo(false);
}
@@ -378,21 +358,6 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
}
}
-void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
-{
- LLPanelLogin* self = (LLPanelLogin*)user_data;
- LLLineEditor* editor = (LLLineEditor*)caller;
- std::string password = editor->getText();
-
- // Re-md5 if we've changed at all
- if (password != self->mIncomingPassword)
- {
- LLMD5 pass((unsigned char *)password.c_str());
- char munged_password[MD5HEX_STR_SIZE];
- pass.hex_digest(munged_password);
- self->mMungedPassword = munged_password;
- }
-}
LLPanelLogin::~LLPanelLogin()
{
@@ -499,14 +464,14 @@ void LLPanelLogin::giveFocus()
if( sInstance )
{
// Grab focus and move cursor to first blank input field
- std::string first = sInstance->childGetText("first_name_edit");
+ std::string username = sInstance->childGetText("username_edit");
std::string pass = sInstance->childGetText("password_edit");
- BOOL have_first = !first.empty();
+ BOOL have_username = !username.empty();
BOOL have_pass = !pass.empty();
LLLineEditor* edit = NULL;
- if (have_first && !have_pass)
+ if (have_username && !have_pass)
{
// User saved his name but not his password. Move
// focus to password field.
@@ -515,7 +480,7 @@ void LLPanelLogin::giveFocus()
else
{
// User doesn't have a name, so start there.
- edit = sInstance->getChild<LLLineEditor>("first_name_edit");
+ edit = sInstance->getChild<LLLineEditor>("username_edit");
}
if (edit)
@@ -537,8 +502,8 @@ void LLPanelLogin::showLoginWidgets()
// *TODO: Append all the usual login parameters, like first_login=Y etc.
std::string splash_screen_url = sInstance->getString("real_url");
web_browser->navigateTo( splash_screen_url, "text/html" );
- LLUICtrl* first_name_edit = sInstance->getChild<LLUICtrl>("first_name_edit");
- first_name_edit->setFocus(TRUE);
+ LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
+ username_edit->setFocus(TRUE);
}
// static
@@ -560,77 +525,120 @@ void LLPanelLogin::show(const LLRect &rect,
}
// static
-void LLPanelLogin::setFields(const std::string& firstname,
- const std::string& lastname,
- const std::string& password)
+void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
+ BOOL remember)
{
if (!sInstance)
{
llwarns << "Attempted fillFields with no login view shown" << llendl;
return;
}
+ LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
- sInstance->childSetText("first_name_edit", firstname);
- sInstance->childSetText("last_name_edit", lastname);
-
- // Max "actual" password length is 16 characters.
- // Hex digests are always 32 characters.
- if (password.length() == 32)
+ LLSD identifier = credential->getIdentifier();
+ if((std::string)identifier["type"] == "agent")
+ {
+ sInstance->childSetText("username_edit", (std::string)identifier["first_name"] + " " +
+ (std::string)identifier["last_name"]);
+ }
+ else if((std::string)identifier["type"] == "account")
+ {
+ sInstance->childSetText("username_edit", (std::string)identifier["account_name"]);
+ }
+ else
+ {
+ sInstance->childSetText("username_edit", std::string());
+ }
+ // if the password exists in the credential, set the password field with
+ // a filler to get some stars
+ LLSD authenticator = credential->getAuthenticator();
+ LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
+ if(authenticator.isMap() &&
+ authenticator.has("secret") &&
+ (authenticator["secret"].asString().size() > 0))
{
+
// This is a MD5 hex digest of a password.
// We don't actually use the password input field,
// fill it with MAX_PASSWORD characters so we get a
// nice row of asterixes.
const std::string filler("123456789!123456");
- sInstance->childSetText("password_edit", filler);
- sInstance->mIncomingPassword = filler;
- sInstance->mMungedPassword = password;
+ sInstance->childSetText("password_edit", std::string("123456789!123456"));
}
else
{
- // this is a normal text password
- sInstance->childSetText("password_edit", password);
- sInstance->mIncomingPassword = password;
- LLMD5 pass((unsigned char *)password.c_str());
- char munged_password[MD5HEX_STR_SIZE];
- pass.hex_digest(munged_password);
- sInstance->mMungedPassword = munged_password;
+ sInstance->childSetText("password_edit", std::string());
}
+ sInstance->childSetValue("remember_check", remember);
}
// static
-void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
+void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
+ BOOL remember)
{
if (!sInstance)
{
- llwarns << "Attempted addServer with no login view shown" << llendl;
+ llwarns << "Attempted getFields with no login view shown" << llendl;
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());
- LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
- combo->add(server, LLSD(domain_name) );
- combo->setCurrentByIndex(0);
-}
-
-// static
-void LLPanelLogin::getFields(std::string *firstname,
- std::string *lastname,
- std::string *password)
-{
- if (!sInstance)
+ LLSD identifier = LLSD::emptyMap();
+ LLSD authenticator = LLSD::emptyMap();
+
+ if(credential.notNull())
{
- llwarns << "Attempted getFields with no login view shown" << llendl;
- return;
+ authenticator = credential->getAuthenticator();
}
- *firstname = sInstance->childGetText("first_name_edit");
- LLStringUtil::trim(*firstname);
-
- *lastname = sInstance->childGetText("last_name_edit");
- LLStringUtil::trim(*lastname);
+ std::string username = sInstance->childGetText("username_edit");
+ LLStringUtil::trim(username);
+ std::string password = sInstance->childGetText("password_edit");
- *password = sInstance->mMungedPassword;
+ LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
+ // determine if the username is a first/last form or not.
+ size_t separator_index = username.find_first_of(' ');
+ if (separator_index == username.npos)
+ {
+ LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
+ // single username, so this is a 'clear' identifier
+ identifier["type"] = "account";
+ identifier["account_name"] = username;
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ // password is plaintext
+ authenticator["type"] = "clear";
+ authenticator["secret"] = password;
+ }
+ }
+ else if (separator_index == username.find_last_of(' '))
+ {
+ LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+ // traditional firstname / lastname
+ identifier["type"] = "agent";
+ identifier["first_name"] = username.substr(0, separator_index);
+ identifier["last_name"] = username.substr(separator_index+1, username.npos);
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = "hash";
+ authenticator["algorithm"] = "md5";
+ LLMD5 pass((const U8 *)password.c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ authenticator["secret"] = md5pass;
+ }
+ }
+ credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
+ remember = sInstance->childGetValue("remember_check");
}
// static
@@ -650,64 +658,147 @@ BOOL LLPanelLogin::isGridComboDirty()
}
// static
-void LLPanelLogin::getLocation(std::string &location)
+BOOL LLPanelLogin::areCredentialFieldsDirty()
{
if (!sInstance)
{
- llwarns << "Attempted getLocation with no login view shown" << llendl;
- return;
+ llwarns << "Attempted getServer with no login view shown" << llendl;
}
-
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- location = combo->getValue().asString();
+ else
+ {
+ std::string username = sInstance->childGetText("username_edit");
+ LLStringUtil::trim(username);
+ std::string password = sInstance->childGetText("password_edit");
+ LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
+ if(ctrl && ctrl->isDirty())
+ {
+ return true;
+ }
+ ctrl = sInstance->getChild<LLLineEditor>("password_edit");
+ if(ctrl && ctrl->isDirty())
+ {
+ return true;
+ }
+ }
+ return false;
}
+
// static
-void LLPanelLogin::refreshLocation( bool force_visible )
+void LLPanelLogin::updateLocationCombo( bool force_visible )
{
- if (!sInstance) return;
-
-#if USE_VIEWER_AUTH
- loadLoginPage();
-#else
+ if (!sInstance)
+ {
+ return;
+ }
+
+ llinfos << "updatelocationcombo " << LLStartUp::getStartSLURL().asString() << llendl;
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+
+ switch(LLStartUp::getStartSLURL().getType())
+ {
+ case LLSLURL::LOCATION:
+ {
+
+ combo->setCurrentByIndex( 2 );
+ combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());
+ break;
+ }
+ case LLSLURL::HOME_LOCATION:
+ combo->setCurrentByIndex(1);
+ break;
+ default:
+ combo->setCurrentByIndex(0);
+ break;
+ }
+
BOOL show_start = TRUE;
-
+
if ( ! force_visible )
- {
- // Don't show on first run after install
- // Otherwise ShowStartLocation defaults to true.
show_start = gSavedSettings.getBOOL("ShowStartLocation");
- }
-
- // Update the value of the location combo.
- updateLocationUI();
sInstance->childSetVisible("start_location_combo", show_start);
sInstance->childSetVisible("start_location_text", show_start);
-
- BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
- sInstance->childSetVisible("server_combo", show_server);
-
-#endif
+
+ sInstance->childSetVisible("server_combo", TRUE);
}
// static
-void LLPanelLogin::updateLocationUI()
+void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
{
if (!sInstance) return;
- std::string sim_string = LLURLSimString::sInstance.mSimString;
- if (!sim_string.empty())
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ S32 index = combo->getCurrentIndex();
+
+ switch (index)
{
- // Replace "<Type region name>" with this region name
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- combo->remove(2);
- combo->add( sim_string );
- combo->setTextEntry(sim_string);
- combo->setCurrentByIndex( 2 );
+ case 2:
+ {
+ LLSLURL slurl = LLSLURL(combo->getSelectedValue());
+ if((slurl.getType() == LLSLURL::LOCATION) &&
+ (slurl.getGrid() != LLStartUp::getStartSLURL().getGrid()))
+ {
+
+
+ // we've changed the grid, so update the grid selection
+ try
+ {
+ LLStartUp::setStartSLURL(slurl);
+ }
+ catch (LLInvalidGridName ex)
+ {
+ LLSD args;
+ args["GRID"] = slurl.getGrid();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
+ }
+ loadLoginPage();
+ }
+ break;
+ }
+ case 1:
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ break;
+ }
+ default:
+ {
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+ break;
+ }
}
}
+
+// static
+void LLPanelLogin::getLocation(LLSLURL& slurl)
+{
+ LLSLURL result;
+ if (!sInstance)
+ {
+ llwarns << "Attempted getLocation with no login view shown" << llendl;
+ }
+
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+
+ switch(combo->getCurrentIndex())
+ {
+ case 0:
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
+ case 1:
+ slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
+ default:
+ slurl = LLSLURL(combo->getValue().asString());
+ }
+}
+
+void LLPanelLogin::setLocation(const LLSLURL& slurl)
+{
+ LLStartUp::setStartSLURL(slurl);
+ updateServer();
+}
+
// static
void LLPanelLogin::closePanel()
{
@@ -741,15 +832,13 @@ void LLPanelLogin::loadLoginPage()
std::ostringstream oStr;
- std::string login_page = gSavedSettings.getString("LoginPage");
- if (login_page.empty())
- {
- login_page = sInstance->getString( "real_url" );
- }
+ std::string login_page = LLGridManager::getInstance()->getLoginPage();
+
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)
{
@@ -781,11 +870,10 @@ void LLPanelLogin::loadLoginPage()
curl_free(curl_version);
// Grid
- char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
+ char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLoginID().c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
-
- gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
+ gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
@@ -810,30 +898,20 @@ void LLPanelLogin::loadLoginPage()
location = gSavedSettings.getString("LoginLocation");
}
- std::string firstname, lastname;
+ std::string username;
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
- firstname = cmd_line_login[0].asString();
- lastname = cmd_line_login[1].asString();
+ username = cmd_line_login[0].asString() + " " + cmd_line_login[1];
password = cmd_line_login[2].asString();
}
- if (firstname.empty())
- {
- firstname = gSavedSettings.getString("FirstName");
- }
-
- if (lastname.empty())
- {
- lastname = gSavedSettings.getString("LastName");
- }
char* curl_region = curl_escape(region.c_str(), 0);
- oStr <<"firstname=" << firstname <<
- "&lastname=" << lastname << "&location=" << location << "&region=" << curl_region;
+ oStr <<"username=" << username <<
+ "&location=" << location << "&region=" << curl_region;
curl_free(curl_region);
@@ -866,7 +944,7 @@ void LLPanelLogin::loadLoginPage()
#endif
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-
+
// navigate to the "real" page
if (gSavedSettings.getBOOL("RegInClient"))
{
@@ -915,34 +993,33 @@ void LLPanelLogin::onClickConnect(void *)
// JC - Make sure the fields all get committed.
sInstance->setFocus(FALSE);
- std::string first = sInstance->childGetText("first_name_edit");
- std::string last = sInstance->childGetText("last_name_edit");
- LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
- std::string combo_text = combo->getSimple();
-
- bool has_first_and_last = !(first.empty() || last.empty());
- bool has_location = false;
-
- if(combo_text=="<Type region name>" || combo_text =="")
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+ LLSD combo_val = combo->getSelectedValue();
+ if (combo_val.isUndefined())
{
- // *NOTE: Mani - Location field is not always committed by this point!
- // This may be duplicate work, but better than not doing the work!
- LLURLSimString::sInstance.setString("");
+ combo_val = combo->getValue();
}
- else
+ if(combo_val.isUndefined())
{
- // *NOTE: Mani - Location field is not always committed by this point!
- LLURLSimString::sInstance.setString(combo_text);
- has_location = true;
+ LLNotificationsUtil::add("StartRegionEmpty");
+ return;
+ }
+ try
+ {
+ LLGridManager::getInstance()->setGridChoice(combo_val.asString());
}
-
- if(!has_first_and_last)
+ catch (LLInvalidGridName ex)
{
- LLNotificationsUtil::add("MustHaveAccountToLogIn");
+ LLSD args;
+ args["GRID"] = combo_val.asString();
+ LLNotificationsUtil::add("InvalidGrid", args);
+ return;
}
- else if(!has_location)
+
+ std::string username = sInstance->childGetText("username_edit");
+ if(username.empty())
{
- LLNotificationsUtil::add("StartRegionEmpty");
+ LLNotificationsUtil::add("MustHaveAccountToLogIn");
}
else
{
@@ -1005,6 +1082,8 @@ void LLPanelLogin::onClickHelp(void*)
// static
void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
{
+ LLPanelLogin *This = (LLPanelLogin *) user_data;
+ This->mPasswordModified = TRUE;
if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
{
LLNotificationsUtil::add("CapsKeyOn");
@@ -1012,54 +1091,90 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
}
}
-// static
-void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
-{
- // *NOTE: The paramters for this method are ignored.
- // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
- // calls this method.
-
- // The user twiddled with the grid choice ui.
- // apply the selection to the grid setting.
- std::string grid_label;
- S32 grid_index;
- LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
- LLSD combo_val = combo->getValue();
-
- if (LLSD::TypeInteger == combo_val.type())
+void LLPanelLogin::updateServer()
+{
+ try
{
- grid_index = combo->getValue().asInteger();
- if ((S32)GRID_INFO_OTHER == grid_index)
+ updateServerCombo();
+ // if they've selected another grid, we should load the credentials
+ // for that grid and set them to the UI.
+ if(sInstance && !sInstance->areCredentialFieldsDirty())
{
- // This happens if the user specifies a custom grid
- // via command line.
- grid_label = combo->getSimple();
+ LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
+ bool remember = sInstance->childGetValue("remember_check");
+ sInstance->setFields(credential, remember);
}
+ // grid changed so show new splash screen (possibly)
+ loadLoginPage();
+ updateLocationCombo(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
}
- else
+ catch (LLInvalidGridName ex)
{
- // no valid selection, return other
- grid_index = (S32)GRID_INFO_OTHER;
- grid_label = combo_val.asString();
+ // do nothing
}
+}
- // This new seelction will override preset uris
- // from the command line.
- LLViewerLogin* vl = LLViewerLogin::getInstance();
- vl->resetURIs();
- if(grid_index != GRID_INFO_OTHER)
+void LLPanelLogin::updateServerCombo()
+{
+ if (!sInstance)
{
- vl->setGridChoice((EGridInfo)grid_index);
+ return;
}
- else
+ // We add all of the possible values, sorted, and then add a bar and the current value at the top
+ LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
+ server_choice_combo->removeall();
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(TRUE);
+#else
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(FALSE);
+#endif
+ for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
+ grid_choice != known_grids.end();
+ grid_choice++)
{
- vl->setGridChoice(grid_label);
+ if (!grid_choice->first.empty())
+ {
+ server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
+ }
}
+
+ server_choice_combo->addSeparator(ADD_TOP);
+
+ server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(),
+ LLGridManager::getInstance()->getGrid(), ADD_TOP);
+
+ server_choice_combo->selectFirstItem();
+}
- // grid changed so show new splash screen (possibly)
- loadLoginPage();
+// static
+void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
+{
+ // *NOTE: The paramters for this method are ignored.
+ // LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
+ // calls this method.
+ LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
+ // The user twiddled with the grid choice ui.
+ // apply the selection to the grid setting.
+ LLPointer<LLCredential> credential;
+
+ LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+ LLSD combo_val = combo->getSelectedValue();
+ if (combo_val.isUndefined())
+ {
+ combo_val = combo->getValue();
+ }
+
+ combo = sInstance->getChild<LLComboBox>("start_location_combo");
+ combo->setCurrentByIndex(1);
+ LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
+ LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+ // This new selection will override preset uris
+ // from the command line.
+ updateServer();
+ updateLocationCombo(false);
+ updateLoginPanelLinks();
}
void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
@@ -1072,3 +1187,14 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
onSelectServer(combo, NULL);
}
}
+
+void LLPanelLogin::updateLoginPanelLinks()
+{
+ LLSD grid_data = LLGridManager::getInstance()->getGridInfo();
+ bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
+
+ // need to call through sInstance, as it's called from onSelectServer, which
+ // is static.
+ sInstance->childSetVisible("create_new_account_text", system_grid);
+ sInstance->childSetVisible("forgot_password_text", system_grid);
+}