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.cpp187
1 files changed, 81 insertions, 106 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 42e4b397db..1cb0f4601b 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -215,22 +215,18 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
// change z sort of clickable text to be behind buttons
- sendChildToBack(getChildView("channel_text"));
+ //sendChildToBack(getChildView("channel_text"));
sendChildToBack(getChildView("forgot_password_text"));
LLLineEditor* edit = getChild<LLLineEditor>("password_edit");
if (edit) edit->setDrawAsterixes(TRUE);
- LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
-
if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
{
LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
LLStartUp::setStartSLURL(slurl);
}
updateLocationCombo(false);
-
- combo->setCommitCallback(onSelectLocation, NULL);
LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
server_choice_combo->setCommitCallback(onSelectServer, NULL);
@@ -245,10 +241,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
std::string version = llformat("%s (%d)",
LLVersionInfo::getShortVersion().c_str(),
LLVersionInfo::getBuild());
- LLTextBox* channel_text = getChild<LLTextBox>("channel_text");
- channel_text->setTextArg("[CHANNEL]", channel); // though not displayed
- channel_text->setTextArg("[VERSION]", version);
- channel_text->setClickedCallback(onClickVersion, this);
+ //LLTextBox* channel_text = getChild<LLTextBox>("channel_text");
+ //channel_text->setTextArg("[CHANNEL]", channel); // though not displayed
+ //channel_text->setTextArg("[VERSION]", version);
+ //channel_text->setClickedCallback(onClickVersion, this);
LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text");
forgot_password_text->setClickedCallback(onClickForgotPassword, NULL);
@@ -274,20 +270,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
web_browser->setTabStop(FALSE);
// web_browser->navigateToLocalPage( "loading", "loading.html" );
- if (gSavedSettings.getBOOL("RegInClient"))
- {
- // need to follow links in the internal browser
- web_browser->setOpenInExternalBrowser( false );
-
- getChild<LLView>("login_widgets")->setVisible(false);
- }
- else
- {
- // make links open in external browser
- web_browser->setOpenInExternalBrowser( true );
-
- reshapeBrowser();
- }
+ reshapeBrowser();
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
@@ -420,12 +403,6 @@ void LLPanelLogin::draw()
// virtual
BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask)
{
- if (( KEY_RETURN == key ) && (MASK_ALT == mask))
- {
- gViewerWindow->toggleFullscreen(FALSE);
- return TRUE;
- }
-
if ( KEY_F1 == key )
{
LLViewerHelp* vhelp = LLViewerHelp::getInstance();
@@ -497,7 +474,6 @@ void LLPanelLogin::showLoginWidgets()
{
sInstance->childSetVisible("login_widgets", true);
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
- web_browser->setOpenInExternalBrowser( true );
sInstance->reshapeBrowser();
// *TODO: Append all the usual login parameters, like first_login=Y etc.
std::string splash_screen_url = sInstance->getString("real_url");
@@ -575,7 +551,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
// static
void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
- BOOL remember)
+ BOOL& remember)
{
if (!sInstance)
{
@@ -607,34 +583,41 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
{
LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
// single username, so this is a 'clear' identifier
- identifier["type"] = "account";
+ identifier["type"] = CRED_IDENTIFIER_TYPE_ACCOUNT;
identifier["account_name"] = username;
if (LLPanelLogin::sInstance->mPasswordModified)
{
authenticator = LLSD::emptyMap();
// password is plaintext
- authenticator["type"] = "clear";
+ authenticator["type"] = CRED_AUTHENTICATOR_TYPE_CLEAR;
authenticator["secret"] = password;
}
}
- else if (separator_index == username.find_last_of(' '))
+ else
{
- 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);
+ std::string first = username.substr(0, separator_index);
+ std::string last = username.substr(separator_index, username.npos);
+ LLStringUtil::trim(last);
- if (LLPanelLogin::sInstance->mPasswordModified)
+ if (last.find_first_of(' ') == last.npos)
{
- 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;
+ LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+ // traditional firstname / lastname
+ identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT;
+ identifier["first_name"] = first;
+ identifier["last_name"] = last;
+
+ if (LLPanelLogin::sInstance->mPasswordModified)
+ {
+ authenticator = LLSD::emptyMap();
+ authenticator["type"] = CRED_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);
@@ -692,7 +675,6 @@ void LLPanelLogin::updateLocationCombo( bool force_visible )
return;
}
- llinfos << "updatelocationcombo " << LLStartUp::getStartSLURL().asString() << llendl;
LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
switch(LLStartUp::getStartSLURL().getType())
@@ -720,11 +702,13 @@ void LLPanelLogin::updateLocationCombo( bool force_visible )
sInstance->childSetVisible("start_location_combo", show_start);
sInstance->childSetVisible("start_location_text", show_start);
- sInstance->childSetVisible("server_combo", TRUE);
+ BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
+ sInstance->childSetVisible("server_combo_text", show_server);
+ sInstance->childSetVisible("server_combo", show_server);
}
// static
-void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
+void LLPanelLogin::updateStartSLURL()
{
if (!sInstance) return;
@@ -733,30 +717,11 @@ void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
switch (index)
{
- case 2:
+ case 0:
{
- 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();
- }
+ LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
break;
- }
+ }
case 1:
{
LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
@@ -764,35 +729,18 @@ void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
}
default:
{
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+ LLSLURL slurl = LLSLURL(combo->getValue().asString());
+ if(slurl.getType() == LLSLURL::LOCATION)
+ {
+ // we've changed the grid, so update the grid selection
+ LLStartUp::setStartSLURL(slurl);
+ }
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);
@@ -1015,16 +963,44 @@ void LLPanelLogin::onClickConnect(void *)
LLNotificationsUtil::add("InvalidGrid", args);
return;
}
-
+ updateStartSLURL();
std::string username = sInstance->childGetText("username_edit");
+
+
if(username.empty())
{
+ // user must type in something into the username field
LLNotificationsUtil::add("MustHaveAccountToLogIn");
}
else
{
- // has both first and last name typed
- sInstance->mCallback(0, sInstance->mCallbackData);
+ LLPointer<LLCredential> cred;
+ BOOL remember;
+ getFields(cred, remember);
+ std::string identifier_type;
+ cred->identifierType(identifier_type);
+ LLSD allowed_credential_types;
+ LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
+
+ // check the typed in credential type against the credential types expected by the server.
+ for(LLSD::array_iterator i = allowed_credential_types.beginArray();
+ i != allowed_credential_types.endArray();
+ i++)
+ {
+
+ if(i->asString() == identifier_type)
+ {
+ // yay correct credential type
+ sInstance->mCallback(0, sInstance->mCallbackData);
+ return;
+ }
+ }
+
+ // Right now, maingrid is the only thing that is picky about
+ // credential format, as it doesn't yet allow account (single username)
+ // format creds. - Rox. James, we wanna fix the message when we change
+ // this.
+ LLNotificationsUtil::add("InvalidCredentialFormat");
}
}
}
@@ -1086,7 +1062,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
This->mPasswordModified = TRUE;
if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
{
- LLNotificationsUtil::add("CapsKeyOn");
+// *TODO: use another way to notify user about enabled caps lock, see EXT-6858
sCapslockDidNotification = TRUE;
}
}
@@ -1125,11 +1101,9 @@ void LLPanelLogin::updateServerCombo()
// 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
+
+ std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(!gSavedSettings.getBOOL("ShowBetaGrids"));
+
for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
grid_choice != known_grids.end();
grid_choice++)
@@ -1190,7 +1164,8 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
void LLPanelLogin::updateLoginPanelLinks()
{
- LLSD grid_data = LLGridManager::getInstance()->getGridInfo();
+ LLSD grid_data;
+ LLGridManager::getInstance()->getGridInfo(grid_data);
bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
// need to call through sInstance, as it's called from onSelectServer, which