diff options
author | Jacek Antonelli | 2009-11-19 04:19:06 -0600 |
---|---|---|
committer | Jacek Antonelli | 2009-11-19 04:19:06 -0600 |
commit | 1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427 (patch) | |
tree | e09ccbc010e326a48fd91ba15b58afd7fb836b3f /linden/indra/newview/llpanellogin.cpp | |
parent | Fixed minor formatting issue in MANIFESTO.txt. (diff) | |
parent | Fixed CMake setting errors (diff) | |
download | meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.zip meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.gz meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.bz2 meta-impy-1d443b7a94ed6f9ef1d408caef72fcbc0b1ee427.tar.xz |
Merge remote branch 'mccabe/1.3.0-next' into next
Conflicts:
linden/indra/cmake/00-Common.cmake
linden/indra/newview/skins/default/xui/de/floater_about.xml
linden/indra/newview/skins/default/xui/fr/floater_about.xml
linden/indra/newview/skins/default/xui/ja/floater_about.xml
linden/indra/newview/skins/default/xui/ko/floater_about.xml
linden/indra/newview/skins/default/xui/zh/floater_about.xml
linden/install.xml
Diffstat (limited to 'linden/indra/newview/llpanellogin.cpp')
-rw-r--r-- | linden/indra/newview/llpanellogin.cpp | 147 |
1 files changed, 24 insertions, 123 deletions
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp index 1a17b20..e0acd34 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 "hippoGridManager.h" | 39 | #include "hippoGridManager.h" |
@@ -46,7 +48,7 @@ | |||
46 | 48 | ||
47 | #include "llbutton.h" | 49 | #include "llbutton.h" |
48 | #include "llcheckboxctrl.h" | 50 | #include "llcheckboxctrl.h" |
49 | #include "llcommandhandler.h" | 51 | #include "llcommandhandler.h" // for secondlife:///app/login/ |
50 | #include "llcombobox.h" | 52 | #include "llcombobox.h" |
51 | #include "llcurl.h" | 53 | #include "llcurl.h" |
52 | #include "llviewercontrol.h" | 54 | #include "llviewercontrol.h" |
@@ -86,9 +88,6 @@ | |||
86 | 88 | ||
87 | #define USE_VIEWER_AUTH 0 | 89 | #define USE_VIEWER_AUTH 0 |
88 | 90 | ||
89 | std::string load_password_from_disk(void); | ||
90 | void save_password_to_disk(const char* hashed_password); | ||
91 | |||
92 | const S32 BLACK_BORDER_HEIGHT = 160; | 91 | const S32 BLACK_BORDER_HEIGHT = 160; |
93 | const S32 MAX_PASSWORD = 16; | 92 | const S32 MAX_PASSWORD = 16; |
94 | 93 | ||
@@ -100,8 +99,8 @@ class LLLoginRefreshHandler : public LLCommandHandler | |||
100 | { | 99 | { |
101 | public: | 100 | public: |
102 | // don't allow from external browsers | 101 | // don't allow from external browsers |
103 | LLLoginRefreshHandler() : LLCommandHandler("login_refresh", false) { } | 102 | LLLoginRefreshHandler() : LLCommandHandler("login_refresh", true) { } |
104 | bool handle(const LLSD& tokens, const LLSD& queryMap) | 103 | bool handle(const LLSD& tokens, const LLSD& query_map, LLWebBrowserCtrl* web) |
105 | { | 104 | { |
106 | if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) | 105 | if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) |
107 | { | 106 | { |
@@ -114,98 +113,6 @@ public: | |||
114 | LLLoginRefreshHandler gLoginRefreshHandler; | 113 | LLLoginRefreshHandler gLoginRefreshHandler; |
115 | 114 | ||
116 | 115 | ||
117 | //parses the input url and returns true if afterwards | ||
118 | //a web-login-key, firstname and lastname is set | ||
119 | bool LLLoginHandler::parseDirectLogin(std::string url) | ||
120 | { | ||
121 | LLURI uri(url); | ||
122 | parse(uri.queryMap()); | ||
123 | |||
124 | if (mWebLoginKey.isNull() || | ||
125 | mFirstName.empty() || | ||
126 | mLastName.empty()) | ||
127 | { | ||
128 | return false; | ||
129 | } | ||
130 | else | ||
131 | { | ||
132 | return true; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | |||
137 | void LLLoginHandler::parse(const LLSD& queryMap) | ||
138 | { | ||
139 | mWebLoginKey = queryMap["web_login_key"].asUUID(); | ||
140 | mFirstName = queryMap["first_name"].asString(); | ||
141 | mLastName = queryMap["last_name"].asString(); | ||
142 | |||
143 | const std::string &grid = queryMap["grid"].asString(); | ||
144 | if (grid != "") gHippoGridManager->setCurrentGrid(grid); | ||
145 | std::string startLocation = queryMap["location"].asString(); | ||
146 | |||
147 | if (startLocation == "specify") | ||
148 | { | ||
149 | LLURLSimString::setString(queryMap["region"].asString()); | ||
150 | } | ||
151 | else if (startLocation == "home") | ||
152 | { | ||
153 | gSavedSettings.setBOOL("LoginLastLocation", FALSE); | ||
154 | LLURLSimString::setString(LLStringUtil::null); | ||
155 | } | ||
156 | else if (startLocation == "last") | ||
157 | { | ||
158 | gSavedSettings.setBOOL("LoginLastLocation", TRUE); | ||
159 | LLURLSimString::setString(LLStringUtil::null); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | bool LLLoginHandler::handle(const LLSD& tokens, | ||
164 | const LLSD& queryMap) | ||
165 | { | ||
166 | parse(queryMap); | ||
167 | |||
168 | //if we haven't initialized stuff yet, this is | ||
169 | //coming in from the GURL handler, just parse | ||
170 | if (STATE_FIRST == LLStartUp::getStartupState()) | ||
171 | { | ||
172 | return true; | ||
173 | } | ||
174 | |||
175 | std::string password = queryMap["password"].asString(); | ||
176 | |||
177 | if (!password.empty()) | ||
178 | { | ||
179 | gSavedSettings.setBOOL("RememberPassword", TRUE); | ||
180 | |||
181 | if (password.substr(0,3) != "$1$") | ||
182 | { | ||
183 | LLMD5 pass((unsigned char*)password.c_str()); | ||
184 | char md5pass[33]; /* Flawfinder: ignore */ | ||
185 | pass.hex_digest(md5pass); | ||
186 | password = ll_safe_string(md5pass, 32); | ||
187 | save_password_to_disk(password.c_str()); | ||
188 | } | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | save_password_to_disk(NULL); | ||
193 | gSavedSettings.setBOOL("RememberPassword", FALSE); | ||
194 | } | ||
195 | |||
196 | |||
197 | if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page | ||
198 | { | ||
199 | if (mWebLoginKey.isNull()) { | ||
200 | LLPanelLogin::loadLoginPage(); | ||
201 | } else { | ||
202 | LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); | ||
203 | } | ||
204 | } | ||
205 | return true; | ||
206 | } | ||
207 | |||
208 | LLLoginHandler gLoginHandler; | ||
209 | 116 | ||
210 | // helper class that trys to download a URL from a web site and calls a method | 117 | // helper class that trys to download a URL from a web site and calls a method |
211 | // on parent class indicating if the web server is working or not | 118 | // on parent class indicating if the web server is working or not |
@@ -385,7 +292,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, | |||
385 | // get the web browser control | 292 | // get the web browser control |
386 | LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); | 293 | LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); |
387 | // Need to handle login secondlife:///app/ URLs | 294 | // Need to handle login secondlife:///app/ URLs |
388 | web_browser->setOpenAppSLURLs( true ); | 295 | web_browser->setTrusted( true ); |
389 | 296 | ||
390 | // observe browser events | 297 | // observe browser events |
391 | web_browser->addObserver( this ); | 298 | web_browser->addObserver( this ); |
@@ -653,8 +560,9 @@ void LLPanelLogin::show(const LLRect &rect, | |||
653 | } | 560 | } |
654 | 561 | ||
655 | // static | 562 | // static |
656 | void LLPanelLogin::setFields(const std::string& firstname, const std::string& lastname, const std::string& password, | 563 | void LLPanelLogin::setFields(const std::string& firstname, |
657 | BOOL remember) | 564 | const std::string& lastname, |
565 | const std::string& password) | ||
658 | { | 566 | { |
659 | if (!sInstance) | 567 | if (!sInstance) |
660 | { | 568 | { |
@@ -688,8 +596,6 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la | |||
688 | pass.hex_digest(munged_password); | 596 | pass.hex_digest(munged_password); |
689 | sInstance->mMungedPassword = munged_password; | 597 | sInstance->mMungedPassword = munged_password; |
690 | } | 598 | } |
691 | |||
692 | sInstance->childSetValue("remember_check", remember); | ||
693 | } | 599 | } |
694 | 600 | ||
695 | 601 | ||
@@ -739,8 +645,9 @@ void LLPanelLogin::addServer(const std::string& server) | |||
739 | } | 645 | } |
740 | 646 | ||
741 | // static | 647 | // static |
742 | void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std::string &password, | 648 | void LLPanelLogin::getFields(std::string *firstname, |
743 | BOOL &remember) | 649 | std::string *lastname, |
650 | std::string *password) | ||
744 | { | 651 | { |
745 | if (!sInstance) | 652 | if (!sInstance) |
746 | { | 653 | { |
@@ -748,14 +655,13 @@ void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std: | |||
748 | return; | 655 | return; |
749 | } | 656 | } |
750 | 657 | ||
751 | firstname = sInstance->childGetText("first_name_edit"); | 658 | *firstname = sInstance->childGetText("first_name_edit"); |
752 | LLStringUtil::trim(firstname); | 659 | LLStringUtil::trim(*firstname); |
753 | 660 | ||
754 | lastname = sInstance->childGetText("last_name_edit"); | 661 | *lastname = sInstance->childGetText("last_name_edit"); |
755 | LLStringUtil::trim(lastname); | 662 | LLStringUtil::trim(*lastname); |
756 | 663 | ||
757 | password = sInstance->mMungedPassword; | 664 | *password = sInstance->mMungedPassword; |
758 | remember = sInstance->childGetValue("remember_check"); | ||
759 | } | 665 | } |
760 | 666 | ||
761 | // static | 667 | // static |
@@ -1072,18 +978,11 @@ void LLPanelLogin::onClickConnect(void *) | |||
1072 | } | 978 | } |
1073 | else | 979 | else |
1074 | { | 980 | { |
1075 | if (gHideLinks) | 981 | LLNotifications::instance().add("MustHaveAccountToLogIn", LLSD(), LLSD(), |
1076 | { | 982 | LLPanelLogin::newAccountAlertCallback); |
1077 | gViewerWindow->alertXml("MustHaveAccountToLogInNoLinks"); | ||
1078 | } | ||
1079 | else | ||
1080 | { | ||
1081 | gViewerWindow->alertXml("MustHaveAccountToLogIn", | ||
1082 | LLPanelLogin::newAccountAlertCallback); | ||
1083 | } | 983 | } |
1084 | } | 984 | } |
1085 | } | 985 | } |
1086 | } | ||
1087 | 986 | ||
1088 | void LLPanelLogin::onClickGrid(void *) | 987 | void LLPanelLogin::onClickGrid(void *) |
1089 | { | 988 | { |
@@ -1094,8 +993,9 @@ void LLPanelLogin::onClickGrid(void *) | |||
1094 | } | 993 | } |
1095 | 994 | ||
1096 | // static | 995 | // static |
1097 | void LLPanelLogin::newAccountAlertCallback(S32 option, void*) | 996 | bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response) |
1098 | { | 997 | { |
998 | S32 option = LLNotification::getSelectedOption(notification, response); | ||
1099 | if (0 == option) | 999 | if (0 == option) |
1100 | { | 1000 | { |
1101 | llinfos << "Going to account creation URL" << llendl; | 1001 | llinfos << "Going to account creation URL" << llendl; |
@@ -1105,6 +1005,7 @@ void LLPanelLogin::newAccountAlertCallback(S32 option, void*) | |||
1105 | { | 1005 | { |
1106 | sInstance->setFocus(TRUE); | 1006 | sInstance->setFocus(TRUE); |
1107 | } | 1007 | } |
1008 | return false; | ||
1108 | } | 1009 | } |
1109 | 1010 | ||
1110 | 1011 | ||
@@ -1151,7 +1052,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) | |||
1151 | { | 1052 | { |
1152 | if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) | 1053 | if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) |
1153 | { | 1054 | { |
1154 | LLNotifyBox::showXml("CapsKeyOn"); | 1055 | LLNotifications::instance().add("CapsKeyOn"); |
1155 | sCapslockDidNotification = TRUE; | 1056 | sCapslockDidNotification = TRUE; |
1156 | } | 1057 | } |
1157 | } | 1058 | } |