summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-09-03 17:41:39 +0100
committerAimee Linden <aimee@lindenlab.com>2010-09-03 17:41:39 +0100
commitffae589843c2977ae7f70de78d84c936e2a91291 (patch)
tree497660a88fe55382639dea1b2f3499241127470d /indra/newview/llpanellogin.cpp
parent63f2ddf377fa0fc6a666cdc1001289335d86258b (diff)
parent25c29d59cf658acec5901c6f06775add10cf0bfd (diff)
Post-convert merge by convert_monolith.py from /Users/Aimee/Documents/Work/Linden-Lab/Development/viewer/convert/viewer-identity-evolution
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rw-r--r--indra/newview/llpanellogin.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index be1afbd8d7..a55adbc444 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -205,7 +205,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
}
#if !USE_VIEWER_AUTH
- getChild<LLLineEditor>("username_edit")->setPrevalidate(LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
// change z sort of clickable text to be behind buttons
@@ -508,8 +507,16 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
LLSD identifier = credential->getIdentifier();
if((std::string)identifier["type"] == "agent")
{
- sInstance->getChild<LLUICtrl>("username_edit")->setValue((std::string)identifier["first_name"] + " " +
- (std::string)identifier["last_name"]);
+ std::string firstname = identifier["first_name"].asString();
+ std::string lastname = identifier["last_name"].asString();
+ std::string login_id = firstname;
+ if (!lastname.empty() && lastname != "Resident")
+ {
+ // support traditional First Last name SLURLs
+ login_id += " ";
+ login_id += lastname;
+ }
+ sInstance->getChild<LLUICtrl>("username_edit")->setValue(login_id);
}
else if((std::string)identifier["type"] == "account")
{
@@ -573,7 +580,8 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
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)
+ if (separator_index == username.npos
+ && !LLGridManager::getInstance()->isSystemGrid())
{
LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
// single username, so this is a 'clear' identifier
@@ -590,9 +598,23 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
}
else
{
+ // Be lenient in terms of what separators we allow for two-word names
+ // and allow legacy users to login with firstname.lastname
+ separator_index = username.find_first_of(" ._");
std::string first = username.substr(0, separator_index);
- std::string last = username.substr(separator_index, username.npos);
+ std::string last;
+ if (separator_index != username.npos)
+ {
+ last = username.substr(separator_index+1, username.npos);
LLStringUtil::trim(last);
+ }
+ else
+ {
+ // ...on Linden grids, single username users as considered to have
+ // last name "Resident"
+ // *TODO: Make login.cgi support "account_name" like above
+ last = "Resident";
+ }
if (last.find_first_of(' ') == last.npos)
{