summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2010-04-22 15:09:34 -0700
committerRoxie Linden <roxie@lindenlab.com>2010-04-22 15:09:34 -0700
commit5e727964dbd6d5e55dd3a0921e8e1f0f77a99747 (patch)
tree4ff88aee455c4736de6b2f3e11d2828d8e1eecfe
parent5b9da4e8d91acd075dfaf33fb489c480c25e9ade (diff)
DEV-49332 - cryptic error message when typing in single username when logging into maingrid.
Needs to be changed when IE is checked in, of course. Now we check the expected credential formats for a given grid against the format that is typed in, and throw an error if it's invalid.
-rw-r--r--indra/newview/llpanellogin.cpp42
-rw-r--r--indra/newview/llpanellogin.h2
-rw-r--r--indra/newview/llsecapi.cpp52
-rw-r--r--indra/newview/llsecapi.h6
-rw-r--r--indra/newview/llstartup.cpp2
-rw-r--r--indra/newview/llviewernetwork.cpp18
-rw-r--r--indra/newview/llviewernetwork.h6
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml8
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp7
-rw-r--r--indra/newview/tests/llviewernetwork_test.cpp10
10 files changed, 122 insertions, 31 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 22fb70de73..63fe7bfa91 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -571,7 +571,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
// static
void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
- BOOL remember)
+ BOOL& remember)
{
if (!sInstance)
{
@@ -603,14 +603,14 @@ 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;
}
}
@@ -618,14 +618,14 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
{
LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
// traditional firstname / lastname
- identifier["type"] = "agent";
+ identifier["type"] = CRED_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["type"] = CRED_AUTHENTICATOR_TYPE_HASH;
authenticator["algorithm"] = "md5";
LLMD5 pass((const U8 *)password.c_str());
char md5pass[33]; /* Flawfinder: ignore */
@@ -978,14 +978,42 @@ void LLPanelLogin::onClickConnect(void *)
}
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");
}
}
}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index bca051691b..aa6884ea97 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -69,7 +69,7 @@ public:
static void setFields(LLPointer<LLCredential> credential, BOOL remember);
- static void getFields(LLPointer<LLCredential>& credential, BOOL remember);
+ static void getFields(LLPointer<LLCredential>& credential, BOOL& remember);
static BOOL isGridComboDirty();
static BOOL areCredentialFieldsDirty();
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index ba343f5387..b3e96298d2 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -143,19 +143,51 @@ int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
LLSD LLCredential::getLoginParams()
{
LLSD result = LLSD::emptyMap();
- if (mIdentifier["type"].asString() == "agent")
+ try
{
- // legacy credential
- result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
- result["first"] = mIdentifier["first_name"];
- result["last"] = mIdentifier["last_name"];
-
+ if (mIdentifier["type"].asString() == "agent")
+ {
+ // legacy credential
+ result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
+ result["first"] = mIdentifier["first_name"];
+ result["last"] = mIdentifier["last_name"];
+
+ }
+ else if (mIdentifier["type"].asString() == "account")
+ {
+ result["username"] = mIdentifier["account_name"];
+ result["passwd"] = mAuthenticator["secret"];
+
+ }
}
- else if (mIdentifier["type"].asString() == "account")
+ catch (...)
{
- result["username"] = mIdentifier["account_name"];
- result["passwd"] = mAuthenticator["secret"];
-
+ // we could have corrupt data, so simply return a null login param if so
+ LL_WARNS("AppInit") << "Invalid credential" << LL_ENDL;
}
return result;
}
+
+void LLCredential::identifierType(std::string &idType)
+{
+ if(mIdentifier.has("type"))
+ {
+ idType = mIdentifier["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
+}
+
+void LLCredential::authenticatorType(std::string &idType)
+{
+ if(mAuthenticator.has("type"))
+ {
+ idType = mAuthenticator["type"].asString();
+ }
+ else {
+ idType = std::string();
+
+ }
+} \ No newline at end of file
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 5211dc2699..59a1e1eff0 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -286,6 +286,10 @@ bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVe
}
+#define CRED_IDENTIFIER_TYPE_ACCOUNT "account"
+#define CRED_IDENTIFIER_TYPE_AGENT "agent"
+#define CRED_AUTHENTICATOR_TYPE_CLEAR "clear"
+#define CRED_AUTHENTICATOR_TYPE_HASH "hash"
//
// LLCredential - interface for credentials providing the following functionality:
// * persistance of credential information based on grid (for saving username/password)
@@ -312,7 +316,9 @@ public:
mAuthenticator = authenticator;
}
virtual LLSD getIdentifier() { return mIdentifier; }
+ virtual void identifierType(std::string& idType);
virtual LLSD getAuthenticator() { return mAuthenticator; }
+ virtual void authenticatorType(std::string& authType);
virtual LLSD getLoginParams();
virtual std::string getGrid() { return mGrid; }
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index eee92ac413..8e2097762a 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -799,7 +799,7 @@ bool idle_startup()
gViewerWindow->moveProgressViewToFront();
//reset the values that could have come in from a slurl
- // DEV-42215: Make sure they're not empty -- gFirstname and gLastname
+ // DEV-42215: Make sure they're not empty -- gUserCredential
// might already have been set from gSavedSettings, and it's too bad
// to overwrite valid values with empty strings.
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 2673ba4e17..a160572f7a 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -35,6 +35,7 @@
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llsdserialize.h"
+#include "llsecapi.h"
#include "llweb.h"
@@ -92,7 +93,7 @@ void LLGridManager::initialize(const std::string& grid_file)
- addSystemGrid("Secondlife.com (Agni)",
+ addSystemGrid("Agni",
MAINGRID,
"https://login.agni.lindenlab.com/cgi-bin/login.cgi",
"https://secondlife.com/helpers/",
@@ -361,7 +362,17 @@ void LLGridManager::addGrid(LLSD& grid_data)
if (!grid_data.has(GRID_HELPER_URI_VALUE))
{
grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
- }
+ }
+
+ if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
+ {
+ // non system grids and grids that haven't already been configured with values
+ // get both types of credentials.
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
+ grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
+ }
+
LL_INFOS("GridManager") << "ADDING: " << grid << LL_ENDL;
mGridList[grid] = grid_data;
}
@@ -384,7 +395,8 @@ void LLGridManager::addSystemGrid(const std::string& label,
grid[GRID_LOGIN_URI_VALUE].append(login);
grid[GRID_LOGIN_PAGE_VALUE] = login_page;
grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
- grid[GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE] = GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT;
+ grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
+ grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
if (login_id.empty())
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 46f21bf20f..0271e7a7a5 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -43,11 +43,8 @@ extern const char* DEFAULT_LOGIN_PAGE;
#define GRID_LOGIN_PAGE_VALUE "login_page"
#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
#define GRID_IS_FAVORITE_VALUE "favorite"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE "credential_type"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT "agent"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_ACCOUNT "account"
#define MAINGRID "util.agni.lindenlab.com"
-
+#define GRID_LOGIN_IDENTIFIER_TYPES "login_identifier_types"
// defines slurl formats associated with various grids.
// we need to continue to support existing forms, as slurls
// are shared between viewers that may not understand newer
@@ -119,6 +116,7 @@ public:
std::string getLoginPage() {return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE];}
std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; }
std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; }
+ void getLoginIdentifierTypes(LLSD& idTypes) { idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES]; }
// build a slurl for the given region within the selected grid
std::string getSLURLBase(const std::string& grid);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e06f36c823..a0a1113b4d 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -735,6 +735,14 @@ You need an account to enter [SECOND_LIFE]. Would you like to create one now?
<notification
icon="alertmodal.tga"
+ name="InvalidCredentialFormat"
+ type="alertmodal">
+You need to enter both the First and Last name of your avatar into the Username field, then login again.
+ </notification>
+
+
+ <notification
+ icon="alertmodal.tga"
name="AddClassified"
type="alertmodal">
Classified ads appear in the &apos;Classified&apos; section of the Search directory and on [http://secondlife.com/community/classifieds secondlife.com] for one week.
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 67da9f2cdf..1c29feec5f 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -72,6 +72,13 @@ LLSD LLCredential::getLoginParams()
result["last"] ="mylast";
return result;
}
+void LLCredential::identifierType(std::string &idType)
+{
+}
+
+void LLCredential::authenticatorType(std::string &idType)
+{
+}
//-----------------------------------------------------------------------------
#include "../llviewernetwork.h"
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index 90c8357453..025b570be2 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -145,7 +145,7 @@ namespace tut
std::map<std::string, std::string> known_grids = manager->getKnownGrids();
ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 18);
ensure_equals("Agni has the right name and label",
- known_grids[std::string("util.agni.lindenlab.com")], std::string("Secondlife.com (Agni)"));
+ known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
ensure_equals("None exists", known_grids[""], "None");
LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
@@ -153,7 +153,7 @@ namespace tut
ensure_equals("name is correct for agni",
grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
ensure_equals("label is correct for agni",
- grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com (Agni)"));
+ grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
ensure("Login URI is an array",
grid[GRID_LOGIN_URI_VALUE].isArray());
ensure_equals("Agni login uri is correct",
@@ -186,14 +186,14 @@ namespace tut
ensure_equals("adding a grid via a grid file increases known grid size",
known_grids.size(), 19);
ensure_equals("Agni is still there after we've added a grid via a grid file",
- known_grids["util.agni.lindenlab.com"], std::string("Secondlife.com (Agni)"));
+ known_grids["util.agni.lindenlab.com"], std::string("Agni"));
// assure Agni doesn't get overwritten
LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
ensure_equals("Agni grid label was not modified by grid file",
- grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com (Agni)"));
+ grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
ensure_equals("Agni name wasn't modified by grid file",
grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
@@ -320,7 +320,7 @@ namespace tut
LLGridManager::getInstance()->initialize("grid_test.xml");
LLGridManager::getInstance()->addGrid(grid);
LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
- ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Secondlife.com (Agni)"));
+ ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
ensure_equals("getGrid", LLGridManager::getInstance()->getGrid(),
std::string("util.agni.lindenlab.com"));
ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(),