summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-09-03 15:30:16 +0100
committerAimee Linden <aimee@lindenlab.com>2010-09-03 15:30:16 +0100
commit0a74d1593513dc3209fdb29a8dc56b2794b36a29 (patch)
tree1af644fe9ad3c62999c177ae37cbeff2ffe19d62 /indra/newview/llpanellogin.cpp
parentce1a0c6bafad092f9687e3b5a6b4865569d96863 (diff)
parent54b9992eaefe2b68d16a6264c1901f12612e99dc (diff)
Merge between james/viewer-identity-evolution and dessie/viewer-public
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 4b23e63f12..f639d841fc 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -211,7 +211,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
@@ -514,8 +513,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")
{
@@ -579,7 +586,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
@@ -596,9 +604,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)
{