aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanellogin.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llpanellogin.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r--linden/indra/newview/llpanellogin.cpp235
1 files changed, 25 insertions, 210 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp
index 64eecd6..bc5e8f2 100644
--- a/linden/indra/newview/llpanellogin.cpp
+++ b/linden/indra/newview/llpanellogin.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -32,6 +33,7 @@
32#include "llviewerprecompiledheaders.h" 33#include "llviewerprecompiledheaders.h"
33 34
34#include "llpanellogin.h" 35#include "llpanellogin.h"
36
35#include "llpanelgeneral.h" 37#include "llpanelgeneral.h"
36 38
37#include "indra_constants.h" // for key and mask constants 39#include "indra_constants.h" // for key and mask constants
@@ -43,7 +45,7 @@
43 45
44#include "llbutton.h" 46#include "llbutton.h"
45#include "llcheckboxctrl.h" 47#include "llcheckboxctrl.h"
46#include "llcommandhandler.h" 48#include "llcommandhandler.h" // for secondlife:///app/login/
47#include "llcombobox.h" 49#include "llcombobox.h"
48#include "llcurl.h" 50#include "llcurl.h"
49#include "llviewercontrol.h" 51#include "llviewercontrol.h"
@@ -78,9 +80,6 @@
78 80
79#define USE_VIEWER_AUTH 0 81#define USE_VIEWER_AUTH 0
80 82
81std::string load_password_from_disk(void);
82void save_password_to_disk(const char* hashed_password);
83
84const S32 BLACK_BORDER_HEIGHT = 160; 83const S32 BLACK_BORDER_HEIGHT = 160;
85const S32 MAX_PASSWORD = 16; 84const S32 MAX_PASSWORD = 16;
86 85
@@ -92,8 +91,8 @@ class LLLoginRefreshHandler : public LLCommandHandler
92{ 91{
93public: 92public:
94 // don't allow from external browsers 93 // don't allow from external browsers
95 LLLoginRefreshHandler() : LLCommandHandler("login_refresh", false) { } 94 LLLoginRefreshHandler() : LLCommandHandler("login_refresh", true) { }
96 bool handle(const LLSD& tokens, const LLSD& queryMap) 95 bool handle(const LLSD& tokens, const LLSD& query_map, LLWebBrowserCtrl* web)
97 { 96 {
98 if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) 97 if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
99 { 98 {
@@ -106,191 +105,6 @@ public:
106LLLoginRefreshHandler gLoginRefreshHandler; 105LLLoginRefreshHandler gLoginRefreshHandler;
107 106
108 107
109//parses the input url and returns true if afterwards
110//a web-login-key, firstname and lastname is set
111bool LLLoginHandler::parseDirectLogin(std::string url)
112{
113 LLURI uri(url);
114 parse(uri.queryMap());
115
116 if (mWebLoginKey.isNull() ||
117 mFirstName.empty() ||
118 mLastName.empty())
119 {
120 return false;
121 }
122 else
123 {
124 return true;
125 }
126}
127
128
129void LLLoginHandler::parse(const LLSD& queryMap)
130{
131 mWebLoginKey = queryMap["web_login_key"].asUUID();
132 mFirstName = queryMap["first_name"].asString();
133 mLastName = queryMap["last_name"].asString();
134
135 EGridInfo grid_choice = GRID_INFO_NONE;
136 if (queryMap["grid"].asString() == "aditi")
137 {
138 grid_choice = GRID_INFO_ADITI;
139 }
140 else if (queryMap["grid"].asString() == "agni")
141 {
142 grid_choice = GRID_INFO_AGNI;
143 }
144 else if (queryMap["grid"].asString() == "siva")
145 {
146 grid_choice = GRID_INFO_SIVA;
147 }
148 else if (queryMap["grid"].asString() == "damballah")
149 {
150 grid_choice = GRID_INFO_DAMBALLAH;
151 }
152 else if (queryMap["grid"].asString() == "durga")
153 {
154 grid_choice = GRID_INFO_DURGA;
155 }
156 else if (queryMap["grid"].asString() == "shakti")
157 {
158 grid_choice = GRID_INFO_SHAKTI;
159 }
160 else if (queryMap["grid"].asString() == "soma")
161 {
162 grid_choice = GRID_INFO_SOMA;
163 }
164 else if (queryMap["grid"].asString() == "ganga")
165 {
166 grid_choice = GRID_INFO_GANGA;
167 }
168 else if (queryMap["grid"].asString() == "vaak")
169 {
170 grid_choice = GRID_INFO_VAAK;
171 }
172 else if (queryMap["grid"].asString() == "uma")
173 {
174 grid_choice = GRID_INFO_UMA;
175 }
176 else if (queryMap["grid"].asString() == "mohini")
177 {
178 grid_choice = GRID_INFO_MOHINI;
179 }
180 else if (queryMap["grid"].asString() == "yami")
181 {
182 grid_choice = GRID_INFO_YAMI;
183 }
184 else if (queryMap["grid"].asString() == "nandi")
185 {
186 grid_choice = GRID_INFO_NANDI;
187 }
188 else if (queryMap["grid"].asString() == "mitra")
189 {
190 grid_choice = GRID_INFO_MITRA;
191 }
192 else if (queryMap["grid"].asString() == "radha")
193 {
194 grid_choice = GRID_INFO_RADHA;
195 }
196 else if (queryMap["grid"].asString() == "ravi")
197 {
198 grid_choice = GRID_INFO_RAVI;
199 }
200 else if (queryMap["grid"].asString() == "aruna")
201 {
202 grid_choice = GRID_INFO_ARUNA;
203 }
204 else if (queryMap["grid"].asString() == "bharati")
205 {
206 grid_choice = GRID_INFO_BHARATI;
207 }
208 else if (queryMap["grid"].asString() == "chandra")
209 {
210 grid_choice = GRID_INFO_CHANDRA;
211 }
212 else if (queryMap["grid"].asString() == "danu")
213 {
214 grid_choice = GRID_INFO_DANU;
215 }
216 else if (queryMap["grid"].asString() == "parvati")
217 {
218 grid_choice = GRID_INFO_PARVATI;
219 }
220 else if (queryMap["grid"].asString() == "skanda")
221 {
222 grid_choice = GRID_INFO_SKANDA;
223 }
224
225 if(grid_choice != GRID_INFO_NONE)
226 {
227 LLViewerLogin::getInstance()->setGridChoice(grid_choice);
228 }
229
230 std::string startLocation = queryMap["location"].asString();
231
232 if (startLocation == "specify")
233 {
234 LLURLSimString::setString(queryMap["region"].asString());
235 }
236 else if (startLocation == "home")
237 {
238 gSavedSettings.setBOOL("LoginLastLocation", FALSE);
239 LLURLSimString::setString(LLStringUtil::null);
240 }
241 else if (startLocation == "last")
242 {
243 gSavedSettings.setBOOL("LoginLastLocation", TRUE);
244 LLURLSimString::setString(LLStringUtil::null);
245 }
246}
247
248bool LLLoginHandler::handle(const LLSD& tokens,
249 const LLSD& queryMap)
250{
251 parse(queryMap);
252
253 //if we haven't initialized stuff yet, this is
254 //coming in from the GURL handler, just parse
255 if (STATE_FIRST == LLStartUp::getStartupState())
256 {
257 return true;
258 }
259
260 std::string password = queryMap["password"].asString();
261
262 if (!password.empty())
263 {
264 gSavedSettings.setBOOL("RememberPassword", TRUE);
265
266 if (password.substr(0,3) != "$1$")
267 {
268 LLMD5 pass((unsigned char*)password.c_str());
269 char md5pass[33]; /* Flawfinder: ignore */
270 pass.hex_digest(md5pass);
271 password = ll_safe_string(md5pass, 32);
272 save_password_to_disk(password.c_str());
273 }
274 }
275 else
276 {
277 save_password_to_disk(NULL);
278 gSavedSettings.setBOOL("RememberPassword", FALSE);
279 }
280
281
282 if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
283 {
284 if (mWebLoginKey.isNull()) {
285 LLPanelLogin::loadLoginPage();
286 } else {
287 LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
288 }
289 }
290 return true;
291}
292
293LLLoginHandler gLoginHandler;
294 108
295// helper class that trys to download a URL from a web site and calls a method 109// helper class that trys to download a URL from a web site and calls a method
296// on parent class indicating if the web server is working or not 110// on parent class indicating if the web server is working or not
@@ -450,7 +264,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
450 LL_VERSION_PATCH, 264 LL_VERSION_PATCH,
451 LL_VIEWER_BUILD ); 265 LL_VIEWER_BUILD );
452 LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); 266 LLTextBox* channel_text = getChild<LLTextBox>("channel_text");
453 channel_text->setTextArg("[CHANNEL]", channel); 267 channel_text->setTextArg("[CHANNEL]", channel); // though not displayed
454 channel_text->setTextArg("[VERSION]", version); 268 channel_text->setTextArg("[VERSION]", version);
455 channel_text->setClickedCallback(onClickVersion); 269 channel_text->setClickedCallback(onClickVersion);
456 channel_text->setCallbackUserData(this); 270 channel_text->setCallbackUserData(this);
@@ -465,7 +279,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
465 // get the web browser control 279 // get the web browser control
466 LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); 280 LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html");
467 // Need to handle login secondlife:///app/ URLs 281 // Need to handle login secondlife:///app/ URLs
468 web_browser->setOpenAppSLURLs( true ); 282 web_browser->setTrusted( true );
469 283
470 // observe browser events 284 // observe browser events
471 web_browser->addObserver( this ); 285 web_browser->addObserver( this );
@@ -732,8 +546,9 @@ void LLPanelLogin::show(const LLRect &rect,
732} 546}
733 547
734// static 548// static
735void LLPanelLogin::setFields(const std::string& firstname, const std::string& lastname, const std::string& password, 549void LLPanelLogin::setFields(const std::string& firstname,
736 BOOL remember) 550 const std::string& lastname,
551 const std::string& password)
737{ 552{
738 if (!sInstance) 553 if (!sInstance)
739 { 554 {
@@ -767,8 +582,6 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la
767 pass.hex_digest(munged_password); 582 pass.hex_digest(munged_password);
768 sInstance->mMungedPassword = munged_password; 583 sInstance->mMungedPassword = munged_password;
769 } 584 }
770
771 sInstance->childSetValue("remember_check", remember);
772} 585}
773 586
774 587
@@ -787,8 +600,9 @@ void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
787} 600}
788 601
789// static 602// static
790void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std::string &password, 603void LLPanelLogin::getFields(std::string *firstname,
791 BOOL &remember) 604 std::string *lastname,
605 std::string *password)
792{ 606{
793 if (!sInstance) 607 if (!sInstance)
794 { 608 {
@@ -796,14 +610,13 @@ void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std:
796 return; 610 return;
797 } 611 }
798 612
799 firstname = sInstance->childGetText("first_name_edit"); 613 *firstname = sInstance->childGetText("first_name_edit");
800 LLStringUtil::trim(firstname); 614 LLStringUtil::trim(*firstname);
801 615
802 lastname = sInstance->childGetText("last_name_edit"); 616 *lastname = sInstance->childGetText("last_name_edit");
803 LLStringUtil::trim(lastname); 617 LLStringUtil::trim(*lastname);
804 618
805 password = sInstance->mMungedPassword; 619 *password = sInstance->mMungedPassword;
806 remember = sInstance->childGetValue("remember_check");
807} 620}
808 621
809// static 622// static
@@ -1086,16 +899,17 @@ void LLPanelLogin::onClickConnect(void *)
1086 } 899 }
1087 else 900 else
1088 { 901 {
1089 gViewerWindow->alertXml("MustHaveAccountToLogIn", 902 LLNotifications::instance().add("MustHaveAccountToLogIn", LLSD(), LLSD(),
1090 LLPanelLogin::newAccountAlertCallback); 903 LLPanelLogin::newAccountAlertCallback);
1091 } 904 }
1092 } 905 }
1093} 906}
1094 907
1095 908
1096// static 909// static
1097void LLPanelLogin::newAccountAlertCallback(S32 option, void*) 910bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response)
1098{ 911{
912 S32 option = LLNotification::getSelectedOption(notification, response);
1099 if (0 == option) 913 if (0 == option)
1100 { 914 {
1101 llinfos << "Going to account creation URL" << llendl; 915 llinfos << "Going to account creation URL" << llendl;
@@ -1105,6 +919,7 @@ void LLPanelLogin::newAccountAlertCallback(S32 option, void*)
1105 { 919 {
1106 sInstance->setFocus(TRUE); 920 sInstance->setFocus(TRUE);
1107 } 921 }
922 return false;
1108} 923}
1109 924
1110 925
@@ -1151,7 +966,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
1151{ 966{
1152 if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) 967 if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
1153 { 968 {
1154 LLNotifyBox::showXml("CapsKeyOn"); 969 LLNotifications::instance().add("CapsKeyOn");
1155 sCapslockDidNotification = TRUE; 970 sCapslockDidNotification = TRUE;
1156 } 971 }
1157} 972}