summaryrefslogtreecommitdiff
path: root/indra/newview/llloginhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llloginhandler.cpp')
-rw-r--r--indra/newview/llloginhandler.cpp236
1 files changed, 146 insertions, 90 deletions
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 48be251611..e3817eecc4 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -3,25 +3,31 @@
* @brief Handles filling in the login panel information from a SLURL
* such as secondlife:///app/login?first=Bob&last=Dobbs
*
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ *
+ * Copyright (c) 2008-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
@@ -29,14 +35,13 @@
#include "llloginhandler.h"
// viewer includes
-#include "llsecapi.h"
#include "lllogininstance.h" // to check if logged in yet
#include "llpanellogin.h" // save_password_to_disk()
#include "llstartup.h" // getStartupState()
-#include "llslurl.h"
+#include "llurlsimstring.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewernetwork.h" // EGridInfo
-#include "llviewerwindow.h" // getWindow()
+#include "llviewerwindow.h" // getWindow()
// library includes
#include "llmd5.h"
@@ -55,33 +60,109 @@ bool LLLoginHandler::parseDirectLogin(std::string url)
LLURI uri(url);
parse(uri.queryMap());
- // NOTE: Need to add direct login as per identity evolution
- return true;
+ if (/*mWebLoginKey.isNull() ||*/
+ mFirstName.empty() ||
+ mLastName.empty())
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
}
+
void LLLoginHandler::parse(const LLSD& queryMap)
{
+ //mWebLoginKey = queryMap["web_login_key"].asUUID();
+ mFirstName = queryMap["first_name"].asString();
+ mLastName = queryMap["last_name"].asString();
- if (queryMap.has("grid"))
+ EGridInfo grid_choice = GRID_INFO_NONE;
+ if (queryMap["grid"].asString() == "aditi")
{
- LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
+ grid_choice = GRID_INFO_ADITI;
}
-
-
- std::string startLocation = queryMap["location"].asString();
-
- if (startLocation == "specify")
+ else if (queryMap["grid"].asString() == "agni")
+ {
+ grid_choice = GRID_INFO_AGNI;
+ }
+ else if (queryMap["grid"].asString() == "siva")
+ {
+ grid_choice = GRID_INFO_SIVA;
+ }
+ else if (queryMap["grid"].asString() == "damballah")
+ {
+ grid_choice = GRID_INFO_DAMBALLAH;
+ }
+ else if (queryMap["grid"].asString() == "durga")
+ {
+ grid_choice = GRID_INFO_DURGA;
+ }
+ else if (queryMap["grid"].asString() == "shakti")
+ {
+ grid_choice = GRID_INFO_SHAKTI;
+ }
+ else if (queryMap["grid"].asString() == "soma")
+ {
+ grid_choice = GRID_INFO_SOMA;
+ }
+ else if (queryMap["grid"].asString() == "ganga")
+ {
+ grid_choice = GRID_INFO_GANGA;
+ }
+ else if (queryMap["grid"].asString() == "vaak")
+ {
+ grid_choice = GRID_INFO_VAAK;
+ }
+ else if (queryMap["grid"].asString() == "uma")
+ {
+ grid_choice = GRID_INFO_UMA;
+ }
+ else if (queryMap["grid"].asString() == "mohini")
{
- LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
- queryMap["region"].asString()));
+ grid_choice = GRID_INFO_MOHINI;
}
- else if (startLocation == "home")
+ else if (queryMap["grid"].asString() == "yami")
{
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+ grid_choice = GRID_INFO_YAMI;
}
- else if (startLocation == "last")
+ else if (queryMap["grid"].asString() == "nandi")
{
- LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+ grid_choice = GRID_INFO_NANDI;
+ }
+ else if (queryMap["grid"].asString() == "mitra")
+ {
+ grid_choice = GRID_INFO_MITRA;
+ }
+ else if (queryMap["grid"].asString() == "radha")
+ {
+ grid_choice = GRID_INFO_RADHA;
+ }
+ else if (queryMap["grid"].asString() == "ravi")
+ {
+ grid_choice = GRID_INFO_RAVI;
+ }
+ else if (queryMap["grid"].asString() == "aruna")
+ {
+ grid_choice = GRID_INFO_ARUNA;
+ }
+
+ if(grid_choice != GRID_INFO_NONE)
+ {
+ LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+ }
+
+ std::string startLocation = queryMap["location"].asString();
+
+ if (startLocation == "specify")
+ {
+ LLURLSimString::setString(queryMap["region"].asString());
+ }
+ else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out)
+ {
+ LLURLSimString::setString(startLocation);
}
}
@@ -139,65 +220,40 @@ bool LLLoginHandler::handle(const LLSD& tokens,
return true;
}
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
- {
- // as the login page may change from grid to grid, as well as
- // things like username/password/etc, we simply refresh the
- // login page to make sure everything is set up correctly
- LLPanelLogin::loadLoginPage();
- LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
- }
- return true;
-}
-
-
+ std::string password = query_map["password"].asString();
-// Initialize the credentials
-// If the passed in URL contains login info, parse
-// that into a credential and web login key. Otherwise
-// check the command line. If the command line
-// does not contain any login creds, load the last saved
-// ones from the protected credential store.
-// This always returns with a credential structure set in the
-// login handler
-LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()
-{
- LLPointer<LLCredential> result = NULL;
- // so try to load it from the UserLoginInfo
- result = loadSavedUserLoginInfo();
- if (result.isNull())
- {
- result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
- }
-
- return result;
-}
+ if (!password.empty())
+ {
+ gSavedSettings.setBOOL("RememberPassword", TRUE);
+ if (password.substr(0,3) != "$1$")
+ {
+ LLMD5 pass((unsigned char*)password.c_str());
+ char md5pass[33]; /* Flawfinder: ignore */
+ pass.hex_digest(md5pass);
+ std::string hashed_password = ll_safe_string(md5pass, 32);
+ LLStartUp::savePasswordToDisk(hashed_password);
+ }
+ }
+
-LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
-{
- // load the saved user login info into a LLCredential.
- // perhaps this should be moved.
- LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
- if (cmd_line_login.size() == 3)
+ if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
{
-
- LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
- char md5pass[33]; /* Flawfinder: ignore */
- pass.hex_digest(md5pass);
- LLSD identifier = LLSD::emptyMap();
- identifier["type"] = "agent";
- identifier["first_name"] = cmd_line_login[0];
- identifier["last_name"] = cmd_line_login[1];
-
- LLSD authenticator = LLSD::emptyMap();
- authenticator["type"] = "hash";
- authenticator["algorithm"] = "md5";
- authenticator["secret"] = md5pass;
- // yuck, we'll fix this with mani's changes.
- gSavedSettings.setBOOL("AutoLogin", TRUE);
- return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(),
- identifier, authenticator);
- }
- return NULL;
+ if (!mFirstName.empty() || !mLastName.empty())
+ {
+ // Fill in the name, and maybe the password
+ LLPanelLogin::setFields(mFirstName, mLastName, password);
+ }
+
+ //if (mWebLoginKey.isNull())
+ //{
+ // LLPanelLogin::loadLoginPage();
+ //}
+ //else
+ //{
+ // LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ //}
+ LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+ }
+ return true;
}