Allow people with last name "Resident" to login using Hippogrid manager.

This commit is contained in:
Aleric Inglewood
2012-10-30 07:16:01 +01:00
parent 65e012c540
commit 3e78b7c262
5 changed files with 37 additions and 18 deletions

View File

@@ -114,7 +114,7 @@ static bool nameSplit(const std::string& full, std::string& first, std::string&
if (fragments.size() == 1)
{
if (gHippoGridManager->getConnectedGrid()->isSecondLife())
last = "resident";
last = "Resident";
else
last = "";
}
@@ -123,8 +123,8 @@ static bool nameSplit(const std::string& full, std::string& first, std::string&
return (fragments.size() <= 2);
}
static std::string nameJoin(const std::string& first,const std::string& last) {
if (last.empty() || boost::algorithm::iequals(last, "resident"))
static std::string nameJoin(const std::string& first,const std::string& last, bool strip_resident) {
if (last.empty() || (strip_resident && boost::algorithm::iequals(last, "Resident")))
return first;
else {
if(std::islower(last[0]))
@@ -134,15 +134,15 @@ static std::string nameJoin(const std::string& first,const std::string& last) {
}
}
static std::string getDisplayString(const std::string& first, const std::string& last, const std::string& grid) {
static std::string getDisplayString(const std::string& first, const std::string& last, const std::string& grid, bool is_secondlife) {
if(grid == gHippoGridManager->getDefaultGridNick())
return nameJoin(first, last);
return nameJoin(first, last, is_secondlife);
else
return nameJoin(first, last) + " (" + grid + ")";
return nameJoin(first, last, is_secondlife) + " (" + grid + ")";
}
static std::string getDisplayString(const LLSavedLoginEntry& entry) {
return getDisplayString(entry.getFirstName(), entry.getLastName(), entry.getGrid());
return getDisplayString(entry.getFirstName(), entry.getLastName(), entry.getGrid(), entry.isSecondLife());
}
class LLLoginRefreshHandler : public LLCommandHandler
@@ -661,8 +661,7 @@ void LLPanelLogin::show(const LLRect &rect,
// static
void LLPanelLogin::setFields(const std::string& firstname,
const std::string& lastname,
const std::string& password,
const LLSavedLogins& login_history)
const std::string& password)
{
if (!sInstance)
{
@@ -673,7 +672,7 @@ void LLPanelLogin::setFields(const std::string& firstname,
LLComboBox* login_combo = sInstance->getChild<LLComboBox>("name_combo");
llassert_always(firstname.find(' ') == std::string::npos);
login_combo->setLabel(nameJoin(firstname, lastname));
login_combo->setLabel(nameJoin(firstname, lastname, false));
// Max "actual" password length is 16 characters.
// Hex digests are always 32 characters.
@@ -710,7 +709,7 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus)
}
LLCheckBoxCtrl* remember_pass_check = sInstance->getChild<LLCheckBoxCtrl>("remember_check");
std::string fullname = nameJoin(entry.getFirstName(), entry.getLastName());
std::string fullname = nameJoin(entry.getFirstName(), entry.getLastName(), entry.isSecondLife());
LLComboBox* login_combo = sInstance->getChild<LLComboBox>("name_combo");
login_combo->setTextEntry(fullname);
login_combo->resetTextDirty();

View File

@@ -71,10 +71,10 @@ public:
* @param firstname First name value.
* @param lastname Last name value.
* @param password Password, as plaintext or munged.
* @param login_history Login history object. An empty one can be provided if no history is available.
* @param is_secondlife True if First/Last refer to a SecondLife(tm) account.
*/
static void setFields(const std::string& firstname, const std::string& lastname,
const std::string& password, const LLSavedLogins& login_history = LLSavedLogins());
const std::string& password);
/**
* @brief Set the values of the displayed fields from a populated history entry.

View File

@@ -145,6 +145,22 @@ const LLSD LLSavedLoginEntry::encryptPassword(const std::string& password)
return pwdata;
}
bool LLSavedLoginEntry::isSecondLife() const
{
if (!mEntry.has("grid"))
{
return false;
}
std::string name = mEntry.get("grid").asString();
HippoGridInfo* grid_info = gHippoGridManager->getGrid(name);
llassert(grid_info);
if (!grid_info)
{
return name.substr(0, 11) == "Second Life";
}
return grid_info->isSecondLife();
}
//---------------------------------------------------------------------------
// LLSavedLogins methods
//---------------------------------------------------------------------------

View File

@@ -119,7 +119,9 @@ public:
void setGrid(const std::string& value){
mEntry.insert("grid", LLSD(value));
}
bool isSecondLife() const;
LLSD asLLSD() const;
static const size_t PASSWORD_HASH_LENGTH = 32;

View File

@@ -32,6 +32,7 @@
#include "llviewerprecompiledheaders.h"
#include <boost/algorithm/string.hpp>
#include "llstartup.h"
#if LL_WINDOWS
@@ -893,7 +894,7 @@ bool idle_startup()
}
else
{
LLPanelLogin::setFields(firstname, lastname, password, login_history);
LLPanelLogin::setFields(firstname, lastname, password);
// <edit>
gFullName = utf8str_tolower(firstname + " " + lastname);
// </edit>
@@ -1591,10 +1592,11 @@ bool idle_startup()
if(process_login_success_response(password))
{
std::string name = firstname;
std::string last_name = lastname;
LLStringUtil::toLower(last_name);
if(last_name != "resident")
if (!gHippoGridManager->getCurrentGrid()->isSecondLife() ||
!boost::algorithm::iequals(lastname, "Resident"))
{
name += " " + lastname;
}
gViewerWindow->getWindow()->setTitle(LLAppViewer::instance()->getWindowTitle() + "- " + name);
// Pass the user information to the voice chat server interface.
gVoiceClient->userAuthorized(firstname, lastname, gAgentID);