aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
authorDavid Seikel2011-04-26 21:30:21 +1000
committerDavid Seikel2011-04-26 21:30:21 +1000
commitda97e24c3b045d16589124496d032ffb9b4ca07f (patch)
tree34d84cf4355f83e1a106d06a10ed2a4bb121fdc4 /linden/indra/newview/llpanellogin.cpp
parentApparently there is a wrong client tag for firestorm out in the wild. (diff)
parentChanged version to Experimental 2011.04.19 (diff)
downloadmeta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.zip
meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.gz
meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.bz2
meta-impy-da97e24c3b045d16589124496d032ffb9b4ca07f.tar.xz
Merge remote-tracking branch 'imprudence/exp' into exp
Conflicts (for future reference): linden/indra/llcommon/llstring.cpp linden/indra/newview/llpanelnetwork.cpp linden/indra/newview/llselectmgr.cpp linden/indra/newview/llstartup.cpp linden/indra/newview/lltoolmgr.cpp linden/indra/newview/llvoavatar.cpp
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r--linden/indra/newview/llpanellogin.cpp135
1 files changed, 71 insertions, 64 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp
index cb61647..39df8b6 100644
--- a/linden/indra/newview/llpanellogin.cpp
+++ b/linden/indra/newview/llpanellogin.cpp
@@ -91,6 +91,7 @@
91 91
92const S32 BLACK_BORDER_HEIGHT = 160; 92const S32 BLACK_BORDER_HEIGHT = 160;
93const S32 MAX_PASSWORD = 16; 93const S32 MAX_PASSWORD = 16;
94const std::string PASSWORD_FILLER = "123456789!123456";
94 95
95LLPanelLogin *LLPanelLogin::sInstance = NULL; 96LLPanelLogin *LLPanelLogin::sInstance = NULL;
96BOOL LLPanelLogin::sCapslockDidNotification = FALSE; 97BOOL LLPanelLogin::sCapslockDidNotification = FALSE;
@@ -174,7 +175,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
174 mLogoImage(), 175 mLogoImage(),
175 mCallback(callback), 176 mCallback(callback),
176 mCallbackData(cb_data), 177 mCallbackData(cb_data),
177 mHtmlAvailable( TRUE ) 178 mHtmlAvailable( TRUE ),
179 mActualPassword("")
178{ 180{
179 setFocusRoot(TRUE); 181 setFocusRoot(TRUE);
180 182
@@ -200,7 +202,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
200 mLogoImage = LLUI::getUIImage("startup_logo.j2c"); 202 mLogoImage = LLUI::getUIImage("startup_logo.j2c");
201 203
202 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); 204 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml");
203 205
204#if USE_VIEWER_AUTH 206#if USE_VIEWER_AUTH
205 //leave room for the login menu bar 207 //leave room for the login menu bar
206 setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); 208 setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0));
@@ -212,7 +214,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
212 childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); 214 childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace);
213 childSetPrevalidate("username_edit", LLLineEditor::prevalidatePrintableSpace); 215 childSetPrevalidate("username_edit", LLLineEditor::prevalidatePrintableSpace);
214 216
215 childSetCommitCallback("password_edit", mungePassword); 217 childSetCommitCallback("password_edit", onPasswordChanged, this);
216 childSetKeystrokeCallback("password_edit", onPassKey, this); 218 childSetKeystrokeCallback("password_edit", onPassKey, this);
217 childSetUserData("password_edit", this); 219 childSetUserData("password_edit", this);
218 220
@@ -364,22 +366,6 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
364 } 366 }
365} 367}
366 368
367void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
368{
369 LLPanelLogin* self = (LLPanelLogin*)user_data;
370 LLLineEditor* editor = (LLLineEditor*)caller;
371 std::string password = editor->getText();
372
373 // Re-md5 if we've changed at all
374 if (password != self->mIncomingPassword)
375 {
376 LLMD5 pass((unsigned char *)password.c_str());
377 char munged_password[MD5HEX_STR_SIZE];
378 pass.hex_digest(munged_password);
379 self->mMungedPassword = munged_password;
380 }
381}
382
383LLPanelLogin::~LLPanelLogin() 369LLPanelLogin::~LLPanelLogin()
384{ 370{
385 LLPanelLogin::sInstance = NULL; 371 LLPanelLogin::sInstance = NULL;
@@ -598,6 +584,8 @@ void LLPanelLogin::setFields(const std::string& firstname,
598// static 584// static
599void LLPanelLogin::setPassword(const std::string& password) 585void LLPanelLogin::setPassword(const std::string& password)
600{ 586{
587 // we check for sInstance before getting here
588
601 // Max "actual" password length is 16 characters. 589 // Max "actual" password length is 16 characters.
602 // Hex digests are always 32 characters. 590 // Hex digests are always 32 characters.
603 if (password.length() == 32) 591 if (password.length() == 32)
@@ -606,21 +594,16 @@ void LLPanelLogin::setPassword(const std::string& password)
606 // We don't actually use the password input field, 594 // We don't actually use the password input field,
607 // fill it with MAX_PASSWORD characters so we get a 595 // fill it with MAX_PASSWORD characters so we get a
608 // nice row of asterixes. 596 // nice row of asterixes.
609 const std::string filler("123456789!123456"); 597 sInstance->childSetText("password_edit", PASSWORD_FILLER);
610 sInstance->childSetText("password_edit", filler);
611 sInstance->mIncomingPassword = filler;
612 sInstance->mMungedPassword = password;
613 } 598 }
614 else 599 else
615 { 600 {
616 // this is a normal text password 601 // this is a normal text password
617 sInstance->childSetText("password_edit", password); 602 sInstance->childSetText("password_edit", password);
618 sInstance->mIncomingPassword = password;
619 LLMD5 pass((unsigned char *)password.c_str());
620 char munged_password[MD5HEX_STR_SIZE];
621 pass.hex_digest(munged_password);
622 sInstance->mMungedPassword = munged_password;
623 } 603 }
604
605 // munging happens in the grid manager now
606 sInstance->mActualPassword = password;
624} 607}
625 608
626 609
@@ -716,7 +699,8 @@ void LLPanelLogin::getFields(std::string *firstname,
716 LLStringUtil::trim(*lastname); 699 LLStringUtil::trim(*lastname);
717 } 700 }
718 701
719 *password = sInstance->mMungedPassword; 702 // sent to us from LLStartUp. Saved only on an actual connect
703 *password = sInstance->mActualPassword;
720} 704}
721 705
722// static 706// static
@@ -844,9 +828,9 @@ void LLPanelLogin::refreshLoginPage()
844 if (!sInstance) return; 828 if (!sInstance) return;
845 829
846 sInstance->childSetVisible("create_new_account_text", 830 sInstance->childSetVisible("create_new_account_text",
847 !gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()); 831 !gHippoGridManager->getCurrentGrid()->getRegisterURL().empty());
848 sInstance->childSetVisible("forgot_password_text", 832 sInstance->childSetVisible("forgot_password_text",
849 !gHippoGridManager->getCurrentGrid()->getPasswordUrl().empty()); 833 !gHippoGridManager->getCurrentGrid()->getPasswordURL().empty());
850 834
851 // kick off a request to grab the url manually 835 // kick off a request to grab the url manually
852 gResponsePtr = LLIamHereLogin::build(sInstance); 836 gResponsePtr = LLIamHereLogin::build(sInstance);
@@ -868,44 +852,47 @@ void LLPanelLogin::loadLoginForm()
868 if (!sInstance) return; 852 if (!sInstance) return;
869 853
870 // toggle between username/first+last login based on grid -- MC 854 // toggle between username/first+last login based on grid -- MC
871 LLTextBox* firstnamet = sInstance->getChild<LLTextBox>("first_name_text"); 855 LLTextBox* firstname_t = sInstance->getChild<LLTextBox>("first_name_text");
872 LLTextBox* lastnamet = sInstance->getChild<LLTextBox>("last_name_text"); 856 LLTextBox* lastname_t = sInstance->getChild<LLTextBox>("last_name_text");
873 LLTextBox* usernamet = sInstance->getChild<LLTextBox>("username_text"); 857 LLTextBox* username_t = sInstance->getChild<LLTextBox>("username_text");
874 858
875 LLLineEditor* firstnamel = sInstance->getChild<LLLineEditor>("first_name_edit"); 859 LLLineEditor* firstname_l = sInstance->getChild<LLLineEditor>("first_name_edit");
876 LLLineEditor* lastnamel = sInstance->getChild<LLLineEditor>("last_name_edit"); 860 LLLineEditor* lastname_l = sInstance->getChild<LLLineEditor>("last_name_edit");
877 LLLineEditor* usernamel = sInstance->getChild<LLLineEditor>("username_edit"); 861 LLLineEditor* username_l = sInstance->getChild<LLLineEditor>("username_edit");
878 862
879 firstnamet->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 863 firstname_t->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat());
880 lastnamet->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 864 lastname_t->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat());
881 usernamet->setVisible(gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 865 username_t->setVisible(gHippoGridManager->getCurrentGrid()->isUsernameCompat());
882 866
883 firstnamel->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 867 firstname_l->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat());
884 lastnamel->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 868 lastname_l->setVisible(!gHippoGridManager->getCurrentGrid()->isUsernameCompat());
885 usernamel->setVisible(gHippoGridManager->getCurrentGrid()->isUsernameCompat()); 869 username_l->setVisible(gHippoGridManager->getCurrentGrid()->isUsernameCompat());
886 870
887 // these should really REALLY be stored in the grid info -- MC 871 // get name info if we've got it
888 std::string firstnames = gSavedSettings.getString("FirstName"); 872 std::string firstname_s = gHippoGridManager->getCurrentGrid()->getFirstName();
889 std::string lastnames = gSavedSettings.getString("LastName"); 873 std::string lastname_s = gHippoGridManager->getCurrentGrid()->getLastName();
890 if (!firstnames.empty() && !lastnames.empty()) 874 if (gHippoGridManager->getCurrentGrid()->isUsernameCompat())
891 { 875 {
892 if (gHippoGridManager->getCurrentGrid()->isUsernameCompat()) 876 if (lastname_s == "resident" || lastname_s == "Resident")
893 { 877 {
894 if (lastnames == "resident" || lastnames == "Resident") 878 username_l->setText(firstname_s);
895 { 879 }
896 usernamel->setText(firstnames); 880 else if (!firstname_s.empty() && !lastname_s.empty())
897 } 881 {
898 else 882 username_l->setText(firstname_s+"."+lastname_s);
899 {
900 usernamel->setText(firstnames+"."+lastnames);
901 }
902 } 883 }
903 else 884 else
904 { 885 {
905 firstnamel->setText(firstnames); 886 username_l->clear();
906 lastnamel->setText(lastnames);
907 } 887 }
908 } 888 }
889 else
890 {
891 firstname_l->setText(firstname_s);
892 lastname_l->setText(lastname_s);
893 }
894
895 setPassword(gHippoGridManager->getCurrentGrid()->getPassword());
909} 896}
910 897
911 898
@@ -1223,16 +1210,33 @@ bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD&
1223// static 1210// static
1224void LLPanelLogin::onClickNewAccount(void*) 1211void LLPanelLogin::onClickNewAccount(void*)
1225{ 1212{
1226 const std::string &url = gHippoGridManager->getConnectedGrid()->getRegisterUrl(); 1213 const std::string &url = gHippoGridManager->getConnectedGrid()->getRegisterURL();
1227 if (!url.empty()) { 1214 if (!url.empty())
1215 {
1228 llinfos << "Going to account creation URL." << llendl; 1216 llinfos << "Going to account creation URL." << llendl;
1229 LLWeb::loadURLExternal(url); 1217 LLWeb::loadURLExternal(url);
1230 } else { 1218 }
1219 else
1220 {
1231 llinfos << "Account creation URL is empty." << llendl; 1221 llinfos << "Account creation URL is empty." << llendl;
1232 sInstance->setFocus(TRUE); 1222 sInstance->setFocus(TRUE);
1233 } 1223 }
1234} 1224}
1235 1225
1226// static
1227void LLPanelLogin::onPasswordChanged(LLUICtrl* caller, void* user_data)
1228{
1229 LLPanelLogin* self = (LLPanelLogin*)user_data;
1230 LLLineEditor* editor = (LLLineEditor*)caller;
1231 std::string password = editor->getText();
1232
1233 // update if we've changed at all
1234 // is there a good way to let users know we can't let them use PASSWORD_FILLER?
1235 if (password != self->mActualPassword && password != PASSWORD_FILLER)
1236 {
1237 self->mActualPassword = password;
1238 }
1239}
1236 1240
1237// *NOTE: This function is dead as of 2008 August. I left it here in case 1241// *NOTE: This function is dead as of 2008 August. I left it here in case
1238// we suddenly decide to put the Quit button back. JC 1242// we suddenly decide to put the Quit button back. JC
@@ -1261,10 +1265,13 @@ void LLPanelLogin::onClickForgotPassword(void*)
1261{ 1265{
1262 if (sInstance ) 1266 if (sInstance )
1263 { 1267 {
1264 const std::string &url = gHippoGridManager->getConnectedGrid()->getPasswordUrl(); 1268 const std::string &url = gHippoGridManager->getConnectedGrid()->getPasswordURL();
1265 if (!url.empty()) { 1269 if (!url.empty())
1270 {
1266 LLWeb::loadURLExternal(url); 1271 LLWeb::loadURLExternal(url);
1267 } else { 1272 }
1273 else
1274 {
1268 llwarns << "Link for 'forgotton password' not set." << llendl; 1275 llwarns << "Link for 'forgotton password' not set." << llendl;
1269 } 1276 }
1270 } 1277 }