diff options
author | Roxie Linden <roxie@lindenlab.com> | 2010-04-29 12:32:35 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2010-04-29 12:32:35 -0700 |
commit | 268a7dbad8e277519a0e10da2cceee25994410b0 (patch) | |
tree | 989e72961502c02a0bd27ede4541250c2f60eabf /indra/newview/llpanellogin.cpp | |
parent | ef07674b553be1f970df8efad763315ea405261f (diff) |
DEV-49491 - Multiple spaces between first and last name in username cause failed login
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
-rw-r--r-- | indra/newview/llpanellogin.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 8d4f715c6e..8e86aa9c56 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -614,23 +614,30 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential, 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"] = CRED_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"] = 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; + 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); |