diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llpanellogin.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index d7fecfd..ffee058 100644 --- a/linden/indra/newview/llpanellogin.cpp +++ b/linden/indra/newview/llpanellogin.cpp | |||
@@ -79,7 +79,7 @@ | |||
79 | 79 | ||
80 | #define USE_VIEWER_AUTH 0 | 80 | #define USE_VIEWER_AUTH 0 |
81 | 81 | ||
82 | LLString load_password_from_disk(void); | 82 | std::string load_password_from_disk(void); |
83 | void save_password_to_disk(const char* hashed_password); | 83 | void save_password_to_disk(const char* hashed_password); |
84 | 84 | ||
85 | const S32 BLACK_BORDER_HEIGHT = 160; | 85 | const S32 BLACK_BORDER_HEIGHT = 160; |
@@ -146,6 +146,10 @@ void LLLoginHandler::parse(const LLSD& queryMap) | |||
146 | { | 146 | { |
147 | grid_choice = GRID_INFO_SIVA; | 147 | grid_choice = GRID_INFO_SIVA; |
148 | } | 148 | } |
149 | else if (queryMap["grid"].asString() == "damballah") | ||
150 | { | ||
151 | grid_choice = GRID_INFO_DAMBALLAH; | ||
152 | } | ||
149 | else if (queryMap["grid"].asString() == "durga") | 153 | else if (queryMap["grid"].asString() == "durga") |
150 | { | 154 | { |
151 | grid_choice = GRID_INFO_DURGA; | 155 | grid_choice = GRID_INFO_DURGA; |
@@ -204,7 +208,7 @@ void LLLoginHandler::parse(const LLSD& queryMap) | |||
204 | LLViewerLogin::getInstance()->setGridChoice(grid_choice); | 208 | LLViewerLogin::getInstance()->setGridChoice(grid_choice); |
205 | } | 209 | } |
206 | 210 | ||
207 | LLString startLocation = queryMap["location"].asString(); | 211 | std::string startLocation = queryMap["location"].asString(); |
208 | 212 | ||
209 | if (startLocation == "specify") | 213 | if (startLocation == "specify") |
210 | { | 214 | { |
@@ -213,12 +217,12 @@ void LLLoginHandler::parse(const LLSD& queryMap) | |||
213 | else if (startLocation == "home") | 217 | else if (startLocation == "home") |
214 | { | 218 | { |
215 | gSavedSettings.setBOOL("LoginLastLocation", FALSE); | 219 | gSavedSettings.setBOOL("LoginLastLocation", FALSE); |
216 | LLURLSimString::setString(""); | 220 | LLURLSimString::setString(LLStringUtil::null); |
217 | } | 221 | } |
218 | else if (startLocation == "last") | 222 | else if (startLocation == "last") |
219 | { | 223 | { |
220 | gSavedSettings.setBOOL("LoginLastLocation", TRUE); | 224 | gSavedSettings.setBOOL("LoginLastLocation", TRUE); |
221 | LLURLSimString::setString(""); | 225 | LLURLSimString::setString(LLStringUtil::null); |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
@@ -234,7 +238,7 @@ bool LLLoginHandler::handle(const LLSD& tokens, | |||
234 | return true; | 238 | return true; |
235 | } | 239 | } |
236 | 240 | ||
237 | LLString password = queryMap["password"].asString(); | 241 | std::string password = queryMap["password"].asString(); |
238 | 242 | ||
239 | if (!password.empty()) | 243 | if (!password.empty()) |
240 | { | 244 | { |
@@ -245,7 +249,7 @@ bool LLLoginHandler::handle(const LLSD& tokens, | |||
245 | LLMD5 pass((unsigned char*)password.c_str()); | 249 | LLMD5 pass((unsigned char*)password.c_str()); |
246 | char md5pass[33]; /* Flawfinder: ignore */ | 250 | char md5pass[33]; /* Flawfinder: ignore */ |
247 | pass.hex_digest(md5pass); | 251 | pass.hex_digest(md5pass); |
248 | password = md5pass; | 252 | password = ll_safe_string(md5pass, 32); |
249 | save_password_to_disk(password.c_str()); | 253 | save_password_to_disk(password.c_str()); |
250 | } | 254 | } |
251 | } | 255 | } |
@@ -324,7 +328,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
324 | BOOL show_server, | 328 | BOOL show_server, |
325 | void (*callback)(S32 option, void* user_data), | 329 | void (*callback)(S32 option, void* user_data), |
326 | void *cb_data) | 330 | void *cb_data) |
327 | : LLPanel("panel_login", LLRect(0,600,800,0), FALSE), // not bordered | 331 | : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered |
328 | mLogoImage(), | 332 | mLogoImage(), |
329 | mCallback(callback), | 333 | mCallback(callback), |
330 | mCallbackData(cb_data), | 334 | mCallbackData(cb_data), |
@@ -371,7 +375,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
371 | 375 | ||
372 | // change z sort of clickable text to be behind buttons | 376 | // change z sort of clickable text to be behind buttons |
373 | sendChildToBack(getChildView("channel_text")); | 377 | sendChildToBack(getChildView("channel_text")); |
374 | sendChildToBack(getChildView("version_text")); | ||
375 | sendChildToBack(getChildView("forgot_password_text")); | 378 | sendChildToBack(getChildView("forgot_password_text")); |
376 | 379 | ||
377 | LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); | 380 | LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); |
@@ -386,7 +389,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
386 | // 2 - "<Type region name>" | 389 | // 2 - "<Type region name>" |
387 | 390 | ||
388 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); | 391 | BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); |
389 | LLString sim_string = LLURLSimString::sInstance.mSimString; | 392 | std::string sim_string = LLURLSimString::sInstance.mSimString; |
390 | if (!sim_string.empty()) | 393 | if (!sim_string.empty()) |
391 | { | 394 | { |
392 | // Replace "<Type region name>" with this region name | 395 | // Replace "<Type region name>" with this region name |
@@ -414,25 +417,25 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
414 | 417 | ||
415 | setDefaultBtn("connect_btn"); | 418 | setDefaultBtn("connect_btn"); |
416 | 419 | ||
417 | childSetAction("quit_btn", onClickQuit, this); | 420 | // childSetAction("quit_btn", onClickQuit, this); |
418 | 421 | ||
419 | LLTextBox* version_text = getChild<LLTextBox>("version_text"); | 422 | std::string channel = gSavedSettings.getString("VersionChannelName"); |
420 | LLString version = llformat("%d.%d.%d (%d)", | 423 | std::string version = llformat("%d.%d.%d (%d)", |
421 | LL_VERSION_MAJOR, | 424 | LL_VERSION_MAJOR, |
422 | LL_VERSION_MINOR, | 425 | LL_VERSION_MINOR, |
423 | LL_VERSION_PATCH, | 426 | LL_VERSION_PATCH, |
424 | LL_VIEWER_BUILD ); | 427 | LL_VIEWER_BUILD ); |
425 | version_text->setText(version); | ||
426 | version_text->setClickedCallback(onClickVersion); | ||
427 | version_text->setCallbackUserData(this); | ||
428 | |||
429 | LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); | 428 | LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); |
430 | channel_text->setText(gSavedSettings.getString("VersionChannelName")); | 429 | channel_text->setTextArg("[CHANNEL]", channel); |
430 | channel_text->setTextArg("[VERSION]", version); | ||
431 | channel_text->setClickedCallback(onClickVersion); | 431 | channel_text->setClickedCallback(onClickVersion); |
432 | channel_text->setCallbackUserData(this); | 432 | channel_text->setCallbackUserData(this); |
433 | 433 | ||
434 | LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); | 434 | LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); |
435 | forgot_password_text->setClickedCallback(onClickForgotPassword); | 435 | forgot_password_text->setClickedCallback(onClickForgotPassword); |
436 | |||
437 | LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); | ||
438 | create_new_account_text->setClickedCallback(onClickNewAccount); | ||
436 | #endif | 439 | #endif |
437 | 440 | ||
438 | // get the web browser control | 441 | // get the web browser control |
@@ -746,7 +749,7 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la | |||
746 | 749 | ||
747 | 750 | ||
748 | // static | 751 | // static |
749 | void LLPanelLogin::addServer(const char *server, S32 domain_name) | 752 | void LLPanelLogin::addServer(const std::string& server, S32 domain_name) |
750 | { | 753 | { |
751 | if (!sInstance) | 754 | if (!sInstance) |
752 | { | 755 | { |
@@ -760,7 +763,7 @@ void LLPanelLogin::addServer(const char *server, S32 domain_name) | |||
760 | } | 763 | } |
761 | 764 | ||
762 | // static | 765 | // static |
763 | void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString &password, | 766 | void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std::string &password, |
764 | BOOL &remember) | 767 | BOOL &remember) |
765 | { | 768 | { |
766 | if (!sInstance) | 769 | if (!sInstance) |
@@ -770,10 +773,10 @@ void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString & | |||
770 | } | 773 | } |
771 | 774 | ||
772 | firstname = sInstance->childGetText("first_name_edit"); | 775 | firstname = sInstance->childGetText("first_name_edit"); |
773 | LLString::trim(firstname); | 776 | LLStringUtil::trim(firstname); |
774 | 777 | ||
775 | lastname = sInstance->childGetText("last_name_edit"); | 778 | lastname = sInstance->childGetText("last_name_edit"); |
776 | LLString::trim(lastname); | 779 | LLStringUtil::trim(lastname); |
777 | 780 | ||
778 | password = sInstance->mMungedPassword; | 781 | password = sInstance->mMungedPassword; |
779 | remember = sInstance->childGetValue("remember_check"); | 782 | remember = sInstance->childGetValue("remember_check"); |
@@ -796,7 +799,7 @@ BOOL LLPanelLogin::isGridComboDirty() | |||
796 | } | 799 | } |
797 | 800 | ||
798 | // static | 801 | // static |
799 | void LLPanelLogin::getLocation(LLString &location) | 802 | void LLPanelLogin::getLocation(std::string &location) |
800 | { | 803 | { |
801 | if (!sInstance) | 804 | if (!sInstance) |
802 | { | 805 | { |
@@ -898,7 +901,7 @@ void LLPanelLogin::loadLoginPage() | |||
898 | } | 901 | } |
899 | 902 | ||
900 | // Language | 903 | // Language |
901 | LLString language(gSavedSettings.getString("Language")); | 904 | std::string language(gSavedSettings.getString("Language")); |
902 | if(language == "default") | 905 | if(language == "default") |
903 | { | 906 | { |
904 | language = gSavedSettings.getString("SystemLanguage"); | 907 | language = gSavedSettings.getString("SystemLanguage"); |
@@ -912,7 +915,7 @@ void LLPanelLogin::loadLoginPage() | |||
912 | } | 915 | } |
913 | 916 | ||
914 | // Channel and Version | 917 | // Channel and Version |
915 | LLString version = llformat("%d.%d.%d (%d)", | 918 | std::string version = llformat("%d.%d.%d (%d)", |
916 | LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); | 919 | LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD); |
917 | 920 | ||
918 | char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0); | 921 | char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0); |
@@ -936,9 +939,9 @@ void LLPanelLogin::loadLoginPage() | |||
936 | #if USE_VIEWER_AUTH | 939 | #if USE_VIEWER_AUTH |
937 | LLURLSimString::sInstance.parse(); | 940 | LLURLSimString::sInstance.parse(); |
938 | 941 | ||
939 | LLString location; | 942 | std::string location; |
940 | LLString region; | 943 | std::string region; |
941 | LLString password; | 944 | std::string password; |
942 | 945 | ||
943 | if (LLURLSimString::parse()) | 946 | if (LLURLSimString::parse()) |
944 | { | 947 | { |
@@ -961,7 +964,7 @@ void LLPanelLogin::loadLoginPage() | |||
961 | } | 964 | } |
962 | } | 965 | } |
963 | 966 | ||
964 | LLString firstname, lastname; | 967 | std::string firstname, lastname; |
965 | 968 | ||
966 | if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) | 969 | if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3) |
967 | { | 970 | { |
@@ -1054,8 +1057,8 @@ void LLPanelLogin::onClickConnect(void *) | |||
1054 | // JC - Make sure the fields all get committed. | 1057 | // JC - Make sure the fields all get committed. |
1055 | sInstance->setFocus(FALSE); | 1058 | sInstance->setFocus(FALSE); |
1056 | 1059 | ||
1057 | LLString first = sInstance->childGetText("first_name_edit"); | 1060 | std::string first = sInstance->childGetText("first_name_edit"); |
1058 | LLString last = sInstance->childGetText("last_name_edit"); | 1061 | std::string last = sInstance->childGetText("last_name_edit"); |
1059 | if (!first.empty() && !last.empty()) | 1062 | if (!first.empty() && !last.empty()) |
1060 | { | 1063 | { |
1061 | // has both first and last name typed | 1064 | // has both first and last name typed |
@@ -1063,9 +1066,15 @@ void LLPanelLogin::onClickConnect(void *) | |||
1063 | } | 1066 | } |
1064 | else | 1067 | else |
1065 | { | 1068 | { |
1066 | // empty first or last name | 1069 | if (gHideLinks) |
1067 | // same as clicking new account | 1070 | { |
1068 | onClickNewAccount(NULL); | 1071 | gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks"); |
1072 | } | ||
1073 | else | ||
1074 | { | ||
1075 | gViewerWindow->alertXml("MustHaveAccountToLogIn", | ||
1076 | LLPanelLogin::newAccountAlertCallback); | ||
1077 | } | ||
1069 | } | 1078 | } |
1070 | } | 1079 | } |
1071 | } | 1080 | } |
@@ -1077,7 +1086,7 @@ void LLPanelLogin::newAccountAlertCallback(S32 option, void*) | |||
1077 | if (0 == option) | 1086 | if (0 == option) |
1078 | { | 1087 | { |
1079 | llinfos << "Going to account creation URL" << llendl; | 1088 | llinfos << "Going to account creation URL" << llendl; |
1080 | LLWeb::loadURL( CREATE_ACCOUNT_URL ); | 1089 | LLWeb::loadURLExternal( CREATE_ACCOUNT_URL ); |
1081 | } | 1090 | } |
1082 | else | 1091 | else |
1083 | { | 1092 | { |
@@ -1089,18 +1098,12 @@ void LLPanelLogin::newAccountAlertCallback(S32 option, void*) | |||
1089 | // static | 1098 | // static |
1090 | void LLPanelLogin::onClickNewAccount(void*) | 1099 | void LLPanelLogin::onClickNewAccount(void*) |
1091 | { | 1100 | { |
1092 | if (gHideLinks) | 1101 | LLWeb::loadURLExternal( CREATE_ACCOUNT_URL ); |
1093 | { | ||
1094 | gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks"); | ||
1095 | } | ||
1096 | else | ||
1097 | { | ||
1098 | gViewerWindow->alertXml("MustHaveAccountToLogIn", | ||
1099 | LLPanelLogin::newAccountAlertCallback); | ||
1100 | } | ||
1101 | } | 1102 | } |
1102 | 1103 | ||
1103 | 1104 | ||
1105 | // *NOTE: This function is dead as of 2008 August. I left it here in case | ||
1106 | // we suddenly decide to put the Quit button back. JC | ||
1104 | // static | 1107 | // static |
1105 | void LLPanelLogin::onClickQuit(void*) | 1108 | void LLPanelLogin::onClickQuit(void*) |
1106 | { | 1109 | { |
@@ -1121,15 +1124,15 @@ void LLPanelLogin::onClickVersion(void*) | |||
1121 | LLFloaterAbout::show(NULL); | 1124 | LLFloaterAbout::show(NULL); |
1122 | } | 1125 | } |
1123 | 1126 | ||
1127 | //static | ||
1124 | void LLPanelLogin::onClickForgotPassword(void*) | 1128 | void LLPanelLogin::onClickForgotPassword(void*) |
1125 | { | 1129 | { |
1126 | if (sInstance ) | 1130 | if (sInstance ) |
1127 | { | 1131 | { |
1128 | LLWeb::loadURL(sInstance->getString( "forgot_password_url" )); | 1132 | LLWeb::loadURLExternal(sInstance->getString( "forgot_password_url" )); |
1129 | } | 1133 | } |
1130 | } | 1134 | } |
1131 | 1135 | ||
1132 | |||
1133 | // static | 1136 | // static |
1134 | void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) | 1137 | void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) |
1135 | { | 1138 | { |
@@ -1149,7 +1152,7 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) | |||
1149 | 1152 | ||
1150 | // The user twiddled with the grid choice ui. | 1153 | // The user twiddled with the grid choice ui. |
1151 | // apply the selection to the grid setting. | 1154 | // apply the selection to the grid setting. |
1152 | LLString grid_label; | 1155 | std::string grid_label; |
1153 | S32 grid_index; | 1156 | S32 grid_index; |
1154 | 1157 | ||
1155 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | 1158 | LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); |