summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2008-01-18 19:42:28 +0000
committerJosh Bell <josh@lindenlab.com>2008-01-18 19:42:28 +0000
commit980d8c4599a7ebb62696126f3d5c5709a62f6a9f (patch)
treea02ec78321990d7828673d41a1a086e5f0e71de9 /indra/newview
parent3cb5c6864e0e19de30f3bba0f9fafd1ac695bfd1 (diff)
svn merge -r 77823:77835 svn+ssh://svn.lindenlab.com/svn/linden/branches/loginxui-for-merge
QAR-222
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp77
-rw-r--r--indra/newview/llfloaterpreference.cpp6
-rw-r--r--indra/newview/llpanellogin.cpp461
-rw-r--r--indra/newview/llpanellogin.h25
-rw-r--r--indra/newview/llstartup.cpp140
-rw-r--r--indra/newview/llurldispatcher.cpp3
-rw-r--r--indra/newview/llviewernetwork.cpp68
-rw-r--r--indra/newview/llviewernetwork.h17
-rw-r--r--indra/newview/llviewerwindow.cpp4
9 files changed, 682 insertions, 119 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 28496dc910..907f957bed 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -198,8 +198,8 @@ static EGridInfo GridDefaultChoice = GRID_INFO_AGNI;
static EGridInfo GridDefaultChoice = GRID_INFO_ADITI;
#endif
#else
-// Default userserver for development builds is dmz
-static EGridInfo GridDefaultChoice = GRID_INFO_DMZ;
+// Default userserver for development builds is none
+static EGridInfo GridDefaultChoice = GRID_INFO_NONE;
#endif
#if LL_WINDOWS
@@ -588,44 +588,24 @@ int parse_args(int argc, char **argv)
gGridChoice = GRID_INFO_AGNI;
snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
}
- else if (!strcmp(argv[j], "--dmz"))
- {
- gGridChoice = GRID_INFO_DMZ;
- snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
- }
- else if (!strcmp(argv[j], "--siva"))
- {
- gGridChoice = GRID_INFO_SIVA;
- snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
- }
- else if (!strcmp(argv[j], "--shakti"))
+ else if (!strcmp(argv[j], "--aruna"))
{
- gGridChoice = GRID_INFO_SHAKTI;
- snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
+ gGridChoice = GRID_INFO_ARUNA;
+ sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
else if (!strcmp(argv[j], "--durga"))
{
gGridChoice = GRID_INFO_DURGA;
snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
}
- else if (!strcmp(argv[j], "--soma"))
- {
- gGridChoice = GRID_INFO_SOMA;
- snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
- }
else if (!strcmp(argv[j], "--ganga"))
{
gGridChoice = GRID_INFO_GANGA;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
- else if (!strcmp(argv[j], "--vaak"))
- {
- gGridChoice = GRID_INFO_VAAK;
- sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
- }
- else if (!strcmp(argv[j], "--uma"))
+ else if (!strcmp(argv[j], "--mitra"))
{
- gGridChoice = GRID_INFO_UMA;
+ gGridChoice = GRID_INFO_MITRA;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
else if (!strcmp(argv[j], "--mohini"))
@@ -633,21 +613,11 @@ int parse_args(int argc, char **argv)
gGridChoice = GRID_INFO_MOHINI;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
- else if (!strcmp(argv[j], "--yami"))
- {
- gGridChoice = GRID_INFO_YAMI;
- sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
- }
else if (!strcmp(argv[j], "--nandi"))
{
gGridChoice = GRID_INFO_NANDI;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
- else if (!strcmp(argv[j], "--mitra"))
- {
- gGridChoice = GRID_INFO_MITRA;
- sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
- }
else if (!strcmp(argv[j], "--radha"))
{
gGridChoice = GRID_INFO_RADHA;
@@ -658,9 +628,34 @@ int parse_args(int argc, char **argv)
gGridChoice = GRID_INFO_RAVI;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
- else if (!strcmp(argv[j], "--aruna"))
+ else if (!strcmp(argv[j], "--siva"))
{
- gGridChoice = GRID_INFO_ARUNA;
+ gGridChoice = GRID_INFO_SIVA;
+ snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
+ }
+ else if (!strcmp(argv[j], "--shakti"))
+ {
+ gGridChoice = GRID_INFO_SHAKTI;
+ snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
+ }
+ else if (!strcmp(argv[j], "--soma"))
+ {
+ gGridChoice = GRID_INFO_SOMA;
+ snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); // Flawfinder: ignore
+ }
+ else if (!strcmp(argv[j], "--uma"))
+ {
+ gGridChoice = GRID_INFO_UMA;
+ sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
+ }
+ else if (!strcmp(argv[j], "--vaak"))
+ {
+ gGridChoice = GRID_INFO_VAAK;
+ sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
+ }
+ else if (!strcmp(argv[j], "--yami"))
+ {
+ gGridChoice = GRID_INFO_YAMI;
sprintf(gGridName,"%s", gGridInfo[gGridChoice].mName);
}
else if (!strcmp(argv[j], "-user") && (++j < argc))
@@ -1876,10 +1871,6 @@ bool LLAppViewer::initEarlyConfiguration()
{
snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_AGNI].mName); // Flawfinder: ignore
}
- else if (!strcmp(argv[j], "--dmz"))
- {
- snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_DMZ].mName); // Flawfinder: ignore
- }
else if (!strcmp(argv[j], "--siva"))
{
snprintf(gGridName, MAX_STRING, "%s", gGridInfo[GRID_INFO_SIVA].mName); // Flawfinder: ignore
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index b7b3cef76b..c2780cb8e0 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -442,8 +442,7 @@ void LLFloaterPreference::onClickAbout(void*)
// static
void LLFloaterPreference::onBtnOK( void* userdata )
{
- //refresh splash page if we're displaying it
- LLPanelLogin::loadLoginPage();
+ LLPanelLogin::refreshLocation( false );
LLFloaterPreference *fp =(LLFloaterPreference *)userdata;
// commit any outstanding text entry
@@ -489,8 +488,7 @@ void LLFloaterPreference::onBtnApply( void* userdata )
}
fp->apply();
- //refresh splash page if we're displaying it
- LLPanelLogin::loadLoginPage();
+ LLPanelLogin::refreshLocation( false );
}
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index cf8fff8543..639220bce7 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -71,10 +71,12 @@
#include "llwebbrowserctrl.h"
#include "llfloaterhtml.h"
+//#include "llfloaterhtmlhelp.h"
#include "llfloatertos.h"
#include "llglheaders.h"
+#define USE_VIEWER_AUTH 0
LLString load_password_from_disk(void);
void save_password_to_disk(const char* hashed_password);
@@ -83,6 +85,7 @@ const S32 BLACK_BORDER_HEIGHT = 160;
const S32 MAX_PASSWORD = 16;
LLPanelLogin *LLPanelLogin::sInstance = NULL;
+BOOL LLPanelLogin::sCapslockDidNotification = FALSE;
class LLLoginRefreshHandler : public LLCommandHandler
@@ -350,9 +353,96 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
gUICtrlFactory->buildPanel(this, "panel_login.xml");
+#if USE_VIEWER_AUTH
//leave room for the login menu bar
setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0));
+#endif
reshape(rect.getWidth(), rect.getHeight());
+
+#if !USE_VIEWER_AUTH
+ childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
+ childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
+
+ childSetCommitCallback("password_edit", mungePassword);
+ childSetKeystrokeCallback("password_edit", onPassKey, this);
+ childSetUserData("password_edit", this);
+
+ LLLineEditor* edit = LLUICtrlFactory::getLineEditorByName(this, "password_edit");
+ if (edit) edit->setDrawAsterixes(TRUE);
+
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(this, "start_location_combo");
+ if (combo)
+ {
+ combo->setAllowTextEntry(TRUE, 128, FALSE);
+
+ // The XML file loads the combo with the following labels:
+ // 0 - "My Home"
+ // 1 - "My Last Location"
+ // 2 - "<Type region name>"
+
+ BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation");
+ LLString sim_string = LLURLSimString::sInstance.mSimString;
+ if (!sim_string.empty())
+ {
+ // Replace "<Type region name>" with this region name
+ combo->remove(2);
+ combo->add( sim_string );
+ combo->setTextEntry(sim_string);
+ combo->setCurrentByIndex( 2 );
+ }
+ else if (login_last)
+ {
+ combo->setCurrentByIndex( 1 );
+ }
+ else
+ {
+ combo->setCurrentByIndex( 0 );
+ }
+
+ combo->setCommitCallback( &LLPanelGeneral::set_start_location );
+ }
+
+ // Specific servers added later.
+ childSetVisible("server_combo", show_server);
+
+ childSetAction("new_account_btn", onClickNewAccount, this);
+ childSetVisible("new_account_btn", !gHideLinks);
+
+ childSetAction("connect_btn", onClickConnect, this);
+
+ setDefaultBtn("connect_btn");
+
+ childSetAction("preferences_btn", LLFloaterPreference::show, this);
+
+ childSetAction("quit_btn", onClickQuit, this);
+
+ LLTextBox* version_text = LLUICtrlFactory::getTextBoxByName(this, "version_text");
+ if (version_text)
+ {
+ LLString version = llformat("%d.%d.%d (%d)",
+ LL_VERSION_MAJOR,
+ LL_VERSION_MINOR,
+ LL_VERSION_PATCH,
+ LL_VIEWER_BUILD );
+ version_text->setText(version);
+ version_text->setClickedCallback(onClickVersion);
+ version_text->setCallbackUserData(this);
+ }
+
+ LLTextBox* channel_text = LLUICtrlFactory::getTextBoxByName(this, "channel_text");
+ if (channel_text)
+ {
+ channel_text->setText(gChannelName);
+ channel_text->setClickedCallback(onClickVersion);
+ channel_text->setCallbackUserData(this);
+ }
+
+ LLTextBox* forgot_password_text = LLUICtrlFactory::getTextBoxByName(this, "forgot_password_text");
+ if (forgot_password_text)
+ {
+ forgot_password_text->setClickedCallback(onClickForgotPassword);
+ }
+#endif
// get the web browser control
#if LL_LIBXUL_ENABLED
@@ -371,11 +461,15 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through)
LLRect htmlRect = mRect;
+#if USE_VIEWER_AUTH
htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY(), mRect.getWidth() + 6, mRect.getHeight());
+#else
+ htmlRect.setCenterAndSize( mRect.getCenterX() - 2, mRect.getCenterY() + 40, mRect.getWidth() + 6, mRect.getHeight() - 78 );
+#endif
web_browser->setRect( htmlRect );
web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE );
- reshape( mRect.getWidth(), mRect.getHeight(), 1 );
-
+ reshape( mRect.getWidth(), mRect.getHeight(), 1 );
+
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
std::string login_page = LLAppViewer::instance()->getLoginPage();
@@ -389,7 +483,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mHtmlAvailable = FALSE;
#endif
+#if !USE_VIEWER_AUTH
// Initialize visibility (and don't force visibility - use prefs)
+ refreshLocation( false );
+#endif
}
void LLPanelLogin::setSiteIsAlive( bool alive )
@@ -423,6 +520,21 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
#endif
}
+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()
{
@@ -457,8 +569,12 @@ void LLPanelLogin::draw()
if ( mHtmlAvailable )
{
+#if !USE_VIEWER_AUTH
// draw a background box in black
gl_rect_2d( 0, height - 264, width, 264, LLColor4( 0.0f, 0.0f, 0.0f, 1.f ) );
+ // draw the bottom part of the background image - just the blue background to the native client UI
+ gl_draw_scaled_image(0, -264, width + 8, mLogoImage->getHeight(), mLogoImage);
+#endif
}
else
{
@@ -526,14 +642,61 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
return LLPanel::handleKeyHere(key, mask, called_from_parent);
}
-
+
+// virtual
+void LLPanelLogin::setFocus(BOOL b)
+{
+ if(b != hasFocus())
+ {
+ if(b)
+ {
+ LLPanelLogin::giveFocus();
+ }
+ else
+ {
+ LLPanel::setFocus(b);
+ }
+ }
+}
// static
void LLPanelLogin::giveFocus()
{
-
+#if USE_VIEWER_AUTH
if (sInstance)
+ {
sInstance->setFocus(TRUE);
+ }
+#else
+ if( sInstance )
+ {
+ // Grab focus and move cursor to first blank input field
+ std::string first = sInstance->childGetText("first_name_edit");
+ std::string pass = sInstance->childGetText("password_edit");
+
+ BOOL have_first = !first.empty();
+ BOOL have_pass = !pass.empty();
+
+ LLLineEditor* edit = NULL;
+ if (have_first && !have_pass)
+ {
+ // User saved his name but not his password. Move
+ // focus to password field.
+ edit = LLUICtrlFactory::getLineEditorByName(sInstance, "password_edit");
+ }
+ else
+ {
+ // User doesn't have a name, so start there.
+ edit = LLUICtrlFactory::getLineEditorByName(sInstance, "first_name_edit");
+ }
+
+ if (edit)
+ {
+ edit->setFocus(TRUE);
+ edit->selectAll();
+ }
+ }
+#endif
}
@@ -543,26 +706,186 @@ void LLPanelLogin::show(const LLRect &rect,
void (*callback)(S32 option, void* user_data),
void* callback_data)
{
- new LLPanelLogin(rect, show_server, callback, callback_data);
-
-#if LL_LIBXUL_ENABLED
- LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
-
- if (!web_browser) return;
+ new LLPanelLogin(rect, show_server, callback, callback_data);
if( !gFocusMgr.getKeyboardFocus() )
{
// Grab focus and move cursor to first enabled control
- web_browser->setFocus(TRUE);
+ sInstance->setFocus(TRUE);
}
// Make sure that focus always goes here (and use the latest sInstance that was just created)
- gFocusMgr.setDefaultKeyboardFocus(web_browser);
-#endif
+ gFocusMgr.setDefaultKeyboardFocus(sInstance);
+}
+
+// static
+void LLPanelLogin::setFields(const std::string& firstname, const std::string& lastname, const std::string& password,
+ BOOL remember)
+{
+ if (!sInstance)
+ {
+ llwarns << "Attempted fillFields with no login view shown" << llendl;
+ return;
+ }
+
+ 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)
+ {
+ // 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;
+ }
+ 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->childSetValue("remember_check", remember);
}
// static
+void LLPanelLogin::addServer(const char *server, S32 domain_name)
+{
+ if (!sInstance)
+ {
+ llwarns << "Attempted addServer with no login view shown" << llendl;
+ return;
+ }
+
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo");
+ if (combo)
+ {
+ combo->add(server, LLSD(domain_name) );
+ combo->setCurrentByIndex(0);
+ }
+}
+
+// static
+void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString &password,
+ BOOL &remember)
+{
+ if (!sInstance)
+ {
+ llwarns << "Attempted getFields with no login view shown" << llendl;
+ return;
+ }
+
+ firstname = sInstance->childGetText("first_name_edit");
+ LLString::trim(firstname);
+
+ lastname = sInstance->childGetText("last_name_edit");
+ LLString::trim(lastname);
+
+ password = sInstance->mMungedPassword;
+ remember = sInstance->childGetValue("remember_check");
+}
+
+
+// static. Return TRUE if user made a choice from the popup
+BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name)
+{
+ BOOL user_picked = FALSE;
+ if (!sInstance)
+ {
+ llwarns << "Attempted getServer with no login view shown" << llendl;
+ }
+ else
+ {
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo");
+ if (combo)
+ {
+ LLSD combo_val = combo->getValue();
+ if (LLSD::TypeInteger == combo_val.type())
+ {
+ domain_name = combo->getValue().asInteger();
+
+ if ((S32)GRID_INFO_OTHER == domain_name)
+ {
+ server = gGridName;
+ }
+ }
+ else
+ {
+ // no valid selection, return other
+ domain_name = (S32)GRID_INFO_OTHER;
+ server = combo_val.asString();
+ }
+ user_picked = combo->isDirty();
+ }
+ }
+
+ return user_picked;
+}
+
+// static
+void LLPanelLogin::getLocation(LLString &location)
+{
+ if (!sInstance)
+ {
+ llwarns << "Attempted getLocation with no login view shown" << llendl;
+ return;
+ }
+
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo");
+ if (combo)
+ {
+ location = combo->getValue().asString();
+ }
+}
+
+// static
+void LLPanelLogin::refreshLocation( bool force_visible )
+{
+ if (!sInstance) return;
+
+#if USE_VIEWER_AUTH
+ loadLoginPage();
+#else
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "start_location_combo");
+ if (!combo) return;
+
+ if (LLURLSimString::parse())
+ {
+ combo->setCurrentByIndex( 3 ); // BUG? Maybe 2?
+ combo->setTextEntry(LLURLSimString::sInstance.mSimString);
+ }
+ else
+ {
+ BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation");
+ combo->setCurrentByIndex( login_last ? 1 : 0 );
+ }
+
+ BOOL show_start = TRUE;
+
+ if ( ! force_visible )
+ show_start = gSavedSettings.getBOOL("ShowStartLocation");
+
+ 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
+}
+
+// static
void LLPanelLogin::close()
{
if (sInstance)
@@ -596,11 +919,19 @@ void LLPanelLogin::setAlwaysRefresh(bool refresh)
void LLPanelLogin::loadLoginPage()
{
if (!sInstance) return;
+
+ std::ostringstream oStr;
+ std::string login_page = LLAppViewer::instance()->getLoginPage();
+ if (login_page.empty())
+ {
+ login_page = sInstance->childGetValue( "real_url" ).asString();
+ }
+ oStr << login_page;
+
+#if USE_VIEWER_AUTH
LLURLSimString::sInstance.parse();
- std::ostringstream oStr;
-
LLString location;
LLString region;
LLString password;
@@ -653,11 +984,6 @@ void LLPanelLogin::loadLoginPage()
char* curl_channel = curl_escape(gChannelName.c_str(), 0);
char* curl_version = curl_escape(version.c_str(), 0);
- std::string login_page = LLAppViewer::instance()->getLoginPage();
- if (login_page.empty())
- {
- login_page = sInstance->childGetValue( "real_url" ).asString();
- }
// Use the right delimeter depending on how LLURI parses the URL
LLURI login_page_uri = LLURI(login_page);
@@ -666,7 +992,7 @@ void LLPanelLogin::loadLoginPage()
{
first_query_delimiter = "?";
}
- oStr << login_page << first_query_delimiter << "firstname=" << firstname <<
+ oStr << first_query_delimiter << "firstname=" << firstname <<
"&lastname=" << lastname << "&location=" << location << "&region=" << curl_region <<
"&grid=" << gGridInfo[gGridChoice].mLabel << "&channel=" << curl_channel <<
"&version=" << curl_version;
@@ -675,7 +1001,7 @@ void LLPanelLogin::loadLoginPage()
curl_free(curl_channel);
curl_free(curl_version);
- LLString language(gSavedSettings.getString("Language"));
+ LLString language(gSavedSettings.getString("Language"));
if(language == "default")
{
language = gSavedSettings.getString("SystemLanguage");
@@ -709,6 +1035,7 @@ void LLPanelLogin::loadLoginPage()
if (gSavedSettings.getBOOL("ForceShowGrid"))
oStr << "&show_grid=TRUE";
#endif
+#endif
#if LL_LIBXUL_ENABLED
LLWebBrowserCtrl* web_browser = LLUICtrlFactory::getWebBrowserCtrlByName(sInstance, "login_html");
@@ -741,6 +1068,77 @@ void LLPanelLogin::onNavigateComplete( const EventType& eventIn )
//---------------------------------------------------------------------------
// static
+void LLPanelLogin::onClickConnect(void *)
+{
+ if (sInstance && sInstance->mCallback)
+ {
+ // tell the responder we're not here anymore
+ if ( gResponsePtr )
+ gResponsePtr->setParent( 0 );
+
+ // JC - Make sure the fields all get committed.
+ sInstance->setFocus(FALSE);
+
+ LLString first = sInstance->childGetText("first_name_edit");
+ LLString last = sInstance->childGetText("last_name_edit");
+ if (!first.empty() && !last.empty())
+ {
+ // has both first and last name typed
+
+ // store off custom server entry, if currently selected
+ LLComboBox* combo = LLUICtrlFactory::getComboBoxByName(sInstance, "server_combo");
+ if (combo)
+ {
+ S32 selected_server = combo->getValue();
+ if (selected_server == GRID_INFO_NONE)
+ {
+ LLString custom_server = combo->getValue().asString();
+ gSavedSettings.setString("CustomServer", custom_server);
+ }
+ }
+ sInstance->mCallback(0, sInstance->mCallbackData);
+ }
+ else
+ {
+ // empty first or last name
+ // same as clicking new account
+ onClickNewAccount(NULL);
+ }
+ }
+}
+
+
+// static
+void LLPanelLogin::newAccountAlertCallback(S32 option, void*)
+{
+ if (0 == option)
+ {
+ llinfos << "Going to account creation URL" << llendl;
+ LLWeb::loadURL( CREATE_ACCOUNT_URL );
+ }
+ else
+ {
+ sInstance->setFocus(TRUE);
+ }
+}
+
+
+// static
+void LLPanelLogin::onClickNewAccount(void*)
+{
+ if (gHideLinks)
+ {
+ gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks");
+ }
+ else
+ {
+ gViewerWindow->alertXml("MustHaveAccountToLogIn",
+ LLPanelLogin::newAccountAlertCallback);
+ }
+}
+
+
+// static
void LLPanelLogin::onClickQuit(void*)
{
if (sInstance && sInstance->mCallback)
@@ -759,3 +1157,22 @@ void LLPanelLogin::onClickVersion(void*)
{
LLFloaterAbout::show(NULL);
}
+
+void LLPanelLogin::onClickForgotPassword(void*)
+{
+ if (sInstance )
+ {
+ LLWeb::loadURL(sInstance->childGetValue( "forgot_password_url" ).asString());
+ }
+}
+
+
+// static
+void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
+{
+ if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
+ {
+ LLNotifyBox::showXml("CapsKeyOn");
+ sCapslockDidNotification = TRUE;
+ }
+}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index f2a58b7b5f..ed883dfb51 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -77,11 +77,24 @@ public:
virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
virtual void draw();
+ virtual void setFocus( BOOL b );
static void show(const LLRect &rect, BOOL show_server,
void (*callback)(S32 option, void* user_data),
void* callback_data);
+ static void setFields(const std::string& firstname, const std::string& lastname,
+ const std::string& password, BOOL remember);
+
+ static void addServer(const char *server, S32 domain_name);
+ static void refreshLocation( bool force_visible );
+
+ static void getFields(LLString &firstname, LLString &lastname,
+ LLString &password, BOOL &remember);
+
+ static BOOL getServer(LLString &server, S32& domain_name);
+ static void getLocation(LLString &location);
+
static void close();
void setSiteIsAlive( bool alive );
@@ -89,8 +102,12 @@ public:
static void loadLoginPage();
static void giveFocus();
static void setAlwaysRefresh(bool refresh);
-
+ static void mungePassword(LLUICtrl* caller, void* user_data);
+
private:
+ static void onClickConnect(void*);
+ static void onClickNewAccount(void*);
+ static void newAccountAlertCallback(S32 option, void*);
static void onClickQuit(void*);
static void onClickVersion(void*);
@@ -98,6 +115,8 @@ private:
// browser observer impls
virtual void onNavigateComplete( const EventType& eventIn );
#endif
+ static void onClickForgotPassword(void*);
+ static void onPassKey(LLLineEditor* caller, void* user_data);
private:
LLPointer<LLViewerImage> mLogoImage;
@@ -105,7 +124,11 @@ private:
void (*mCallback)(S32 option, void *userdata);
void* mCallbackData;
+ std::string mIncomingPassword;
+ std::string mMungedPassword;
+
static LLPanelLogin* sInstance;
+ static BOOL sCapslockDidNotification;
BOOL mHtmlAvailable;
};
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 675a447dc4..b50c264c35 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -351,6 +351,7 @@ BOOL idle_startup()
static S32 location_which = START_LOCATION_ID_LAST;
static BOOL show_connect_box = TRUE;
+ static BOOL remember_password = TRUE;
static BOOL stipend_since_login = FALSE;
@@ -655,7 +656,17 @@ BOOL idle_startup()
firstname = gCmdLineFirstName;
lastname = gCmdLineLastName;
+ LLMD5 pass((unsigned char*)gCmdLinePassword.c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ password = md5pass;
+ remember_password = gSavedSettings.getBOOL("RememberPassword");
+
+#ifdef USE_VIEWER_AUTH
show_connect_box = TRUE;
+#else
+ show_connect_box = FALSE;
+#endif
gAutoLogin = TRUE;
}
else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin"))
@@ -664,7 +675,13 @@ BOOL idle_startup()
lastname = gSavedSettings.getString("LastName");
password = load_password_from_disk();
gSavedSettings.setBOOL("RememberPassword", TRUE);
+ remember_password = TRUE;
+
+#ifdef USE_VIEWER_AUTH
show_connect_box = TRUE;
+#else
+ show_connect_box = FALSE;
+#endif
}
else
{
@@ -673,6 +690,7 @@ BOOL idle_startup()
firstname = gSavedSettings.getString("FirstName");
lastname = gSavedSettings.getString("LastName");
password = load_password_from_disk();
+ remember_password = gSavedSettings.getBOOL("RememberPassword");
show_connect_box = TRUE;
}
@@ -694,6 +712,9 @@ BOOL idle_startup()
if (show_connect_box)
{
+ // Load all the name information out of the login view
+ LLPanelLogin::getFields(firstname, lastname, password, remember_password);
+
if (gNoRender)
{
llerrs << "Need to autologin or use command line with norender!" << llendl;
@@ -703,6 +724,8 @@ BOOL idle_startup()
// Show the login dialog
login_show();
+ // connect dialog is already shown, so fill in the names
+ LLPanelLogin::setFields( firstname, lastname, password, remember_password );
LLPanelLogin::giveFocus();
@@ -768,6 +791,11 @@ BOOL idle_startup()
if (show_connect_box)
{
+ // TODO if not use viewer auth
+ // Load all the name information out of the login view
+ LLPanelLogin::getFields(firstname, lastname, password, remember_password);
+ // end TODO
+
// HACK: Try to make not jump on login
gKeyboard->resetKeys();
}
@@ -777,6 +805,16 @@ BOOL idle_startup()
gSavedSettings.setString("FirstName", firstname);
gSavedSettings.setString("LastName", lastname);
+ if (remember_password)
+ {
+ save_password_to_disk(password.c_str());
+ }
+ else
+ {
+ save_password_to_disk(NULL);
+ }
+ gSavedSettings.setBOOL("RememberPassword", remember_password);
+
llinfos << "Attempting login as: " << firstname << " " << lastname << llendl;
gDebugInfo["LoginName"] = firstname + " " + lastname;
}
@@ -823,6 +861,27 @@ BOOL idle_startup()
if (show_connect_box)
{
+ // TODO only set loginuri based on server choice if ! USE_VIEWER_AUTH
+ LLString server_label;
+ S32 domain_name_index;
+ BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index );
+ gGridChoice = (EGridInfo) domain_name_index;
+ gSavedSettings.setS32("ServerChoice", gGridChoice);
+ if (gGridChoice == GRID_INFO_OTHER)
+ {
+ snprintf(gGridName, MAX_STRING, "%s", server_label.c_str());/* Flawfinder: ignore */
+ }
+
+ if ( user_picked_server )
+ { // User picked a grid from the popup, so clear the stored urls and they will be re-generated from gGridChoice
+ sAuthUris.clear();
+ LLAppViewer::instance()->resetURIs();
+ }
+
+ LLString location;
+ LLPanelLogin::getLocation( location );
+ LLURLSimString::setString( location );
+ // END TODO
LLPanelLogin::close();
}
@@ -985,12 +1044,14 @@ BOOL idle_startup()
hashed_mac.finalize();
hashed_mac.hex_digest(hashed_mac_string);
+ // TODO if statement here to use web_login_key
gUserAuthp->authenticate(
sAuthUris[sAuthUriNum].c_str(),
auth_method.c_str(),
firstname.c_str(),
lastname.c_str(),
- web_login_key,
+ // web_login_key,
+ password.c_str(),
start.str().c_str(),
gSkipOptionalUpdate,
gAcceptTOS,
@@ -1262,7 +1323,16 @@ BOOL idle_startup()
if(text) lastname.assign(text);
gSavedSettings.setString("FirstName", firstname);
gSavedSettings.setString("LastName", lastname);
-
+
+ if (remember_password)
+ {
+ save_password_to_disk(password.c_str());
+ }
+ else
+ {
+ save_password_to_disk(NULL);
+ }
+ gSavedSettings.setBOOL("RememberPassword", remember_password);
gSavedSettings.setBOOL("LoginLastLocation", gSavedSettings.getBOOL("LoginLastLocation"));
text = gUserAuthp->getResponse("agent_access");
@@ -1467,6 +1537,8 @@ BOOL idle_startup()
reset_login();
gAutoLogin = FALSE;
show_connect_box = TRUE;
+ // Don't save an incorrect password to disk.
+ save_password_to_disk(NULL);
}
return do_normal_idle;
}
@@ -2378,12 +2450,76 @@ void login_show()
// UI textures have been previously loaded in doPreloadImages()
llinfos << "Setting Servers" << llendl;
+
+ if( GRID_INFO_OTHER == gGridChoice )
+ {
+ LLPanelLogin::addServer( gGridName, GRID_INFO_OTHER );
+ }
+ else
+ {
+ LLPanelLogin::addServer( gGridInfo[gGridChoice].mLabel, gGridChoice );
+ }
+
+ // Arg! We hate loops!
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_ADITI].mLabel, GRID_INFO_ADITI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_AGNI].mLabel, GRID_INFO_AGNI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_ARUNA].mLabel, GRID_INFO_ARUNA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_DURGA].mLabel, GRID_INFO_DURGA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_GANGA].mLabel, GRID_INFO_GANGA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_MITRA].mLabel, GRID_INFO_MITRA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_MOHINI].mLabel, GRID_INFO_MOHINI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_NANDI].mLabel, GRID_INFO_NANDI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_RADHA].mLabel, GRID_INFO_RADHA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_RAVI].mLabel, GRID_INFO_RAVI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_SIVA].mLabel, GRID_INFO_SIVA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_SHAKTI].mLabel, GRID_INFO_SHAKTI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_SOMA].mLabel, GRID_INFO_SOMA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_UMA].mLabel, GRID_INFO_UMA );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_VAAK].mLabel, GRID_INFO_VAAK );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_YAMI].mLabel, GRID_INFO_YAMI );
+ LLPanelLogin::addServer( gGridInfo[GRID_INFO_LOCAL].mLabel, GRID_INFO_LOCAL );
}
// Callback for when login screen is closed. Option 0 = connect, option 1 = quit.
void login_callback(S32 option, void *userdata)
{
+ const S32 CONNECT_OPTION = 0;
+ const S32 QUIT_OPTION = 1;
+ if (CONNECT_OPTION == option)
+ {
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ return;
+ }
+ else if (QUIT_OPTION == option)
+ {
+ // Make sure we don't save the password if the user is trying to clear it.
+ LLString first, last, password;
+ BOOL remember = TRUE;
+ LLPanelLogin::getFields(first, last, password, remember);
+ if (!remember)
+ {
+ // turn off the setting and write out to disk
+ gSavedSettings.setBOOL("RememberPassword", FALSE);
+ gSavedSettings.saveToFile(gSettingsFileName, TRUE);
+
+ // stomp the saved password on disk
+ save_password_to_disk(NULL);
+ }
+
+ // Next iteration through main loop should shut down the app cleanly.
+ LLAppViewer::instance()->userQuit();
+
+ if (LLAppViewer::instance()->quitRequested())
+ {
+ LLPanelLogin::close();
+ }
+ return;
+ }
+ else
+ {
+ llwarns << "Unknown login button clicked" << llendl;
+ }
}
LLString load_password_from_disk()
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 6fec904239..ba8e77afdf 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -197,7 +197,8 @@ bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, BOOL right_mous
LLURLSimString::setString(url);
// We're at the login screen, so make sure user can see
// the login location box to know where they are going.
- LLPanelLogin::loadLoginPage();
+
+ LLPanelLogin::refreshLocation( true );
return true;
}
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index ad0dacbd13..6fb2957023 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -45,54 +45,30 @@ LLGridData gGridInfo[GRID_INFO_COUNT] =
"util.agni.lindenlab.com",
"https://login.agni.lindenlab.com/cgi-bin/login.cgi",
"https://secondlife.com/helpers/" },
- { "DMZ",
- "util.dmz.lindenlab.com",
- "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
- "http://dmz-secondlife.webdev.lindenlab.com/helpers/" },
- { "Siva",
- "util.siva.lindenlab.com",
- "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
- "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Aruna",
+ "util.aruna.lindenlab.com",
+ "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
+ "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
{ "Durga",
"util.durga.lindenlab.com",
"https://login.durga.lindenlab.com/cgi-bin/login.cgi",
"http://durga-secondlife.webdev.lindenlab.com/helpers/" },
- { "Shakti",
- "util.shakti.lindenlab.com",
- "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
- "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
- { "Soma",
- "util.soma.lindenlab.com",
- "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
- "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
{ "Ganga",
"util.ganga.lindenlab.com",
"https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
"http://ganga-secondlife.webdev.lindenlab.com/helpers/" },
- { "Vaak",
- "util.vaak.lindenlab.com",
- "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
- "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
- { "Uma",
- "util.uma.lindenlab.com",
- "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
- "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Mitra",
+ "util.mitra.lindenlab.com",
+ "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
+ "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
{ "Mohini",
"util.mohini.lindenlab.com",
"https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
"http://mohini-secondlife.webdev.lindenlab.com/helpers/" },
- { "Yami",
- "util.yami.lindenlab.com",
- "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
- "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
{ "Nandi",
"util.nandi.lindenlab.com",
"https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
"http://nandi-secondlife.webdev.lindenlab.com/helpers/" },
- { "Mitra",
- "util.mitra.lindenlab.com",
- "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
- "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
{ "Radha",
"util.radha.lindenlab.com",
"https://login.radha.lindenlab.com/cgi-bin/login.cgi",
@@ -101,10 +77,30 @@ LLGridData gGridInfo[GRID_INFO_COUNT] =
"util.ravi.lindenlab.com",
"https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
"http://ravi-secondlife.webdev.lindenlab.com/helpers/" },
- { "Aruna",
- "util.aruna.lindenlab.com",
- "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
- "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Siva",
+ "util.siva.lindenlab.com",
+ "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
+ "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Shakti",
+ "util.shakti.lindenlab.com",
+ "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
+ "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Soma",
+ "util.soma.lindenlab.com",
+ "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
+ "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Uma",
+ "util.uma.lindenlab.com",
+ "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
+ "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Vaak",
+ "util.vaak.lindenlab.com",
+ "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
+ "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
+ { "Yami",
+ "util.yami.lindenlab.com",
+ "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
+ "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
{ "Local",
"localhost",
"https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index dbeaf2c1cd..4de73aae7a 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -40,21 +40,20 @@ enum EGridInfo
GRID_INFO_NONE,
GRID_INFO_ADITI,
GRID_INFO_AGNI,
- GRID_INFO_DMZ,
- GRID_INFO_SIVA,
+ GRID_INFO_ARUNA,
GRID_INFO_DURGA,
- GRID_INFO_SHAKTI,
- GRID_INFO_SOMA,
GRID_INFO_GANGA,
- GRID_INFO_VAAK,
- GRID_INFO_UMA,
+ GRID_INFO_MITRA,
GRID_INFO_MOHINI,
- GRID_INFO_YAMI,
GRID_INFO_NANDI,
- GRID_INFO_MITRA,
GRID_INFO_RADHA,
GRID_INFO_RAVI,
- GRID_INFO_ARUNA,
+ GRID_INFO_SIVA,
+ GRID_INFO_SHAKTI,
+ GRID_INFO_SOMA,
+ GRID_INFO_UMA,
+ GRID_INFO_VAAK,
+ GRID_INFO_YAMI,
GRID_INFO_LOCAL,
GRID_INFO_OTHER, // IP address set via -user or other command line option
GRID_INFO_COUNT
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 405a705b62..6dab10b339 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2426,7 +2426,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid");
gSavedSettings.setBOOL("ForceShowGrid", visible);
- LLPanelLogin::loadLoginPage();
+
+ // Initialize visibility (and don't force visibility - use prefs)
+ LLPanelLogin::refreshLocation( false );
}
}