From 6f4051c93251c4c8a1cff91b3b449f1f25c94382 Mon Sep 17 00:00:00 2001 From: diva Date: Sun, 8 Mar 2009 23:17:49 +0000 Subject: [PATCH] Making the web_login_key code work, even if the LL Viewer doesn't support it. Other clients can launch the LL Viewer with something like this, for example: Process.Start("C:\\Program Files\\SecondLife\\SecondLife.exe", "-loginuri " + loginuri + "?web_login_key=" + web_login_key + " -login " + firstName + " " + lastName + " -multiple"); This requires a prior step for actually getting the key, which can be done like this: http://localhost:9000/?method=login&firstname=barak&lastname=obama&password=123&show_login_form=FALSE --- .../Framework/Communications/LoginService.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 454197a0b8..1c72b7973b 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -116,6 +116,8 @@ namespace OpenSim.Framework.Communications XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable) request.Params[0]; + SniffLoginKey((Uri)request.Params[2], requestData); + bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && (requestData.Contains("passwd") || requestData.Contains("web_login_key"))); @@ -303,7 +305,7 @@ namespace OpenSim.Framework.Communications string passwd = (string) requestData["passwd"]; GoodLogin = AuthenticateUser(userProfile, passwd); } - else if (requestData.Contains("web_login_key")) + if (!GoodLogin && (requestData.Contains("web_login_key"))) { try { @@ -576,7 +578,7 @@ namespace OpenSim.Framework.Communications { UUID webloginkey = UUID.Random(); m_userManager.StoreWebLoginKey(user.ID, webloginkey); - statuscode = 301; + //statuscode = 301; string redirectURL = "about:blank?redirect-http-hack=" + HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + @@ -584,8 +586,9 @@ namespace OpenSim.Framework.Communications "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); //m_log.Info("[WEB]: R:" + redirectURL); returnactions["int_response_code"] = statuscode; - returnactions["str_redirect_location"] = redirectURL; - returnactions["str_response_string"] = "GoodLogin"; + //returnactions["str_redirect_location"] = redirectURL; + //returnactions["str_response_string"] = "GoodLogin"; + returnactions["str_response_string"] = webloginkey.ToString(); } else { @@ -854,5 +857,17 @@ namespace OpenSim.Framework.Communications RootFolderID = rootID; } } + + protected void SniffLoginKey(Uri uri, Hashtable requestData) + { + string uri_str = uri.ToString(); + string[] parts = uri_str.Split(new char[] { '=' }); + if (parts.Length > 1) + { + string web_login_key = parts[1]; + requestData.Add("web_login_key", web_login_key); + m_log.InfoFormat("[LOGIN]: Login with web_login_key {0}", web_login_key); + } + } } }