aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/LoginService.cs
diff options
context:
space:
mode:
authorJeff Ames2008-03-18 03:41:05 +0000
committerJeff Ames2008-03-18 03:41:05 +0000
commit9f7639fd6d2d7fd37587223259303377ee15bab4 (patch)
tree686d6d493fda3dd2de2fa83221a1e5500ddcd37a /OpenSim/Framework/Communications/LoginService.cs
parentBuilding on Joha's update... (diff)
downloadopensim-SC_OLD-9f7639fd6d2d7fd37587223259303377ee15bab4.zip
opensim-SC_OLD-9f7639fd6d2d7fd37587223259303377ee15bab4.tar.gz
opensim-SC_OLD-9f7639fd6d2d7fd37587223259303377ee15bab4.tar.bz2
opensim-SC_OLD-9f7639fd6d2d7fd37587223259303377ee15bab4.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Communications/LoginService.cs')
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs163
1 files changed, 76 insertions, 87 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 5547c24..bb8cad5 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -114,7 +114,6 @@ namespace OpenSim.Framework.UserManagement
114 string clientversion = (string)requestData["version"]; 114 string clientversion = (string)requestData["version"];
115 m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname); 115 m_log.Info("[LOGIN]: Client Version " + clientversion + " for " + firstname + " " + lastname);
116 } 116 }
117
118 117
119 userProfile = GetTheUser(firstname, lastname); 118 userProfile = GetTheUser(firstname, lastname);
120 if (userProfile == null) 119 if (userProfile == null)
@@ -398,7 +397,6 @@ namespace OpenSim.Framework.UserManagement
398 397
399 public Hashtable ProcessHTMLLogin(Hashtable keysvals) 398 public Hashtable ProcessHTMLLogin(Hashtable keysvals)
400 { 399 {
401
402 // Matches all unspecified characters 400 // Matches all unspecified characters
403 // Currently specified,; lowercase letters, upper case letters, numbers, underline 401 // Currently specified,; lowercase letters, upper case letters, numbers, underline
404 // period, space, parens, and dash. 402 // period, space, parens, and dash.
@@ -422,44 +420,42 @@ namespace OpenSim.Framework.UserManagement
422 // the client requires the HTML form field be named 'username' 420 // the client requires the HTML form field be named 'username'
423 // however, the data it sends when it loads the first time is 'firstname' 421 // however, the data it sends when it loads the first time is 'firstname'
424 // another one of those little nuances. 422 // another one of those little nuances.
425
426 423
427 if (keysvals.Contains("firstname")) 424 if (keysvals.Contains("firstname"))
428 firstname = wfcut.Replace((string)keysvals["firstname"],String.Empty,99999); 425 firstname = wfcut.Replace((string)keysvals["firstname"], String.Empty, 99999);
426
429 if (keysvals.Contains("username")) 427 if (keysvals.Contains("username"))
430 firstname = wfcut.Replace((string)keysvals["username"],String.Empty,99999); 428 firstname = wfcut.Replace((string)keysvals["username"], String.Empty, 99999);
431 429
432 if (keysvals.Contains("lastname")) 430 if (keysvals.Contains("lastname"))
433 lastname = wfcut.Replace((string)keysvals["lastname"],String.Empty,99999); 431 lastname = wfcut.Replace((string)keysvals["lastname"], String.Empty, 99999);
434 432
435 if (keysvals.Contains("location")) 433 if (keysvals.Contains("location"))
436 location = wfcut.Replace((string)keysvals["location"],String.Empty,99999); 434 location = wfcut.Replace((string)keysvals["location"], String.Empty, 99999);
437 435
438 if (keysvals.Contains("region")) 436 if (keysvals.Contains("region"))
439 region = wfcut.Replace((string)keysvals["region"],String.Empty,99999); 437 region = wfcut.Replace((string)keysvals["region"], String.Empty, 99999);
440 438
441 if (keysvals.Contains("grid")) 439 if (keysvals.Contains("grid"))
442 grid = wfcut.Replace((string)keysvals["grid"],String.Empty,99999); 440 grid = wfcut.Replace((string)keysvals["grid"], String.Empty, 99999);
443 441
444 if (keysvals.Contains("channel")) 442 if (keysvals.Contains("channel"))
445 channel = wfcut.Replace((string)keysvals["channel"],String.Empty,99999); 443 channel = wfcut.Replace((string)keysvals["channel"], String.Empty, 99999);
446 444
447 if (keysvals.Contains("version")) 445 if (keysvals.Contains("version"))
448 version = wfcut.Replace((string)keysvals["version"],String.Empty,99999); 446 version = wfcut.Replace((string)keysvals["version"], String.Empty, 99999);
449 447
450 if (keysvals.Contains("lang")) 448 if (keysvals.Contains("lang"))
451 lang = wfcut.Replace((string)keysvals["lang"],String.Empty,99999); 449 lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999);
452 450
453 if (keysvals.Contains("password")) 451 if (keysvals.Contains("password"))
454 password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999); 452 password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999);
455 453
456
457 // load our login form. 454 // load our login form.
458 string loginform = GetLoginForm(firstname,lastname,location,region,grid,channel,version,lang,password,errormessages); 455 string loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages);
459 456
460 if (keysvals.ContainsKey("show_login_form")) 457 if (keysvals.ContainsKey("show_login_form"))
461 { 458 {
462
463 UserProfileData user = GetTheUser(firstname, lastname); 459 UserProfileData user = GetTheUser(firstname, lastname);
464 bool goodweblogin = false; 460 bool goodweblogin = false;
465 461
@@ -472,9 +468,10 @@ namespace OpenSim.Framework.UserManagement
472 m_userManager.StoreWebLoginKey(user.UUID, webloginkey); 468 m_userManager.StoreWebLoginKey(user.UUID, webloginkey);
473 statuscode = 301; 469 statuscode = 301;
474 470
475 string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + 471 string redirectURL = "about:blank?redirect-http-hack=" +
476 lastname + 472 System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" +
477 "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); 473 lastname +
474 "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString());
478 //m_log.Info("[WEB]: R:" + redirectURL); 475 //m_log.Info("[WEB]: R:" + redirectURL);
479 returnactions["int_response_code"] = statuscode; 476 returnactions["int_response_code"] = statuscode;
480 returnactions["str_redirect_location"] = redirectURL; 477 returnactions["str_redirect_location"] = redirectURL;
@@ -487,11 +484,7 @@ namespace OpenSim.Framework.UserManagement
487 loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); 484 loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages);
488 returnactions["int_response_code"] = statuscode; 485 returnactions["int_response_code"] = statuscode;
489 returnactions["str_response_string"] = loginform; 486 returnactions["str_response_string"] = loginform;
490
491 } 487 }
492
493
494
495 } 488 }
496 else 489 else
497 { 490 {
@@ -499,7 +492,6 @@ namespace OpenSim.Framework.UserManagement
499 returnactions["str_response_string"] = loginform; 492 returnactions["str_response_string"] = loginform;
500 } 493 }
501 return returnactions; 494 return returnactions;
502
503 } 495 }
504 496
505 public string GetLoginForm(string firstname, string lastname, string location, string region, 497 public string GetLoginForm(string firstname, string lastname, string location, string region,
@@ -537,67 +529,66 @@ namespace OpenSim.Framework.UserManagement
537 public string GetDefaultLoginForm() 529 public string GetDefaultLoginForm()
538 { 530 {
539 string responseString = 531 string responseString =
540 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; 532 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
541 responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; 533 responseString += "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
542 responseString = responseString + "<head>"; 534 responseString += "<head>";
543 responseString = responseString + 535 responseString += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
544 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; 536 responseString += "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
545 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">"; 537 responseString += "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
546 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; 538 responseString += "<title>OpenSim Login</title>";
547 responseString = responseString + "<title>OpenSim Login</title>"; 539 responseString += "<body><br />";
548 responseString = responseString + "<body><br />"; 540 responseString += "<div id=\"login_box\">";
549 responseString = responseString + "<div id=\"login_box\">";
550 541
551 responseString = responseString + "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">"; 542 responseString += "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">";
552 543
553 responseString = responseString + "<div id=\"message\">[$errors]</div>"; 544 responseString += "<div id=\"message\">[$errors]</div>";
554 responseString = responseString + "<fieldset id=\"firstname\">"; 545 responseString += "<fieldset id=\"firstname\">";
555 responseString = responseString + "<legend>First Name:</legend>"; 546 responseString += "<legend>First Name:</legend>";
556 responseString = responseString + "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"[$firstname]\" />"; 547 responseString += "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"[$firstname]\" />";
557 responseString = responseString + "</fieldset>"; 548 responseString += "</fieldset>";
558 responseString = responseString + "<fieldset id=\"lastname\">"; 549 responseString += "<fieldset id=\"lastname\">";
559 responseString = responseString + "<legend>Last Name:</legend>"; 550 responseString += "<legend>Last Name:</legend>";
560 responseString = responseString + "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"[$lastname]\" />"; 551 responseString += "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"[$lastname]\" />";
561 responseString = responseString + "</fieldset>"; 552 responseString += "</fieldset>";
562 responseString = responseString + "<fieldset id=\"password\">"; 553 responseString += "<fieldset id=\"password\">";
563 responseString = responseString + "<legend>Password:</legend>"; 554 responseString += "<legend>Password:</legend>";
564 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; 555 responseString += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
565 responseString = responseString + "<tr>"; 556 responseString += "<tr>";
566 responseString = responseString + "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"[$password]\" /></td>"; 557 responseString += "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"[$password]\" /></td>";
567 responseString = responseString + "</tr>"; 558 responseString += "</tr>";
568 responseString = responseString + "<tr>"; 559 responseString += "<tr>";
569 responseString = responseString + "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" [$remember_password] style=\"margin-left:0px;\"/></td>"; 560 responseString += "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" [$remember_password] style=\"margin-left:0px;\"/></td>";
570 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>"; 561 responseString += "<td><label for=\"remember_password\">Remember password</label></td>";
571 responseString = responseString + "</tr>"; 562 responseString += "</tr>";
572 responseString = responseString + "</table>"; 563 responseString += "</table>";
573 responseString = responseString + "</fieldset>"; 564 responseString += "</fieldset>";
574 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />"; 565 responseString += "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />";
575 responseString = responseString + "<input type=\"hidden\" name=\"method\" value=\"login\" />"; 566 responseString += "<input type=\"hidden\" name=\"method\" value=\"login\" />";
576 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"[$grid]\" />"; 567 responseString += "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"[$grid]\" />";
577 responseString = responseString + "<input type=\"hidden\" id=\"region\" name=\"region\" value=\"[$region]\" />"; 568 responseString += "<input type=\"hidden\" id=\"region\" name=\"region\" value=\"[$region]\" />";
578 responseString = responseString + "<input type=\"hidden\" id=\"location\" name=\"location\" value=\"[$location]\" />"; 569 responseString += "<input type=\"hidden\" id=\"location\" name=\"location\" value=\"[$location]\" />";
579 responseString = responseString + "<input type=\"hidden\" id=\"channel\" name=\"channel\" value=\"[$channel]\" />"; 570 responseString += "<input type=\"hidden\" id=\"channel\" name=\"channel\" value=\"[$channel]\" />";
580 responseString = responseString + "<input type=\"hidden\" id=\"version\" name=\"version\" value=\"[$version]\" />"; 571 responseString += "<input type=\"hidden\" id=\"version\" name=\"version\" value=\"[$version]\" />";
581 responseString = responseString + "<input type=\"hidden\" id=\"lang\" name=\"lang\" value=\"[$lang]\" />"; 572 responseString += "<input type=\"hidden\" id=\"lang\" name=\"lang\" value=\"[$lang]\" />";
582 responseString = responseString + "<div id=\"submitbtn\">"; 573 responseString += "<div id=\"submitbtn\">";
583 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />"; 574 responseString += "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />";
584 responseString = responseString + "</div>"; 575 responseString += "</div>";
585 responseString = responseString + "<div id=\"connecting\" style=\"visibility:hidden\"> Connecting...</div>"; 576 responseString += "<div id=\"connecting\" style=\"visibility:hidden\"> Connecting...</div>";
586 577
587 responseString = responseString + "<div id=\"helplinks\">"; 578 responseString += "<div id=\"helplinks\">";
588 responseString = responseString + "<a href=\"#join now link\" target=\"_blank\"></a> | "; 579 responseString += "<a href=\"#join now link\" target=\"_blank\"></a> | ";
589 responseString = responseString + "<a href=\"#forgot password link\" target=\"_blank\"></a>"; 580 responseString += "<a href=\"#forgot password link\" target=\"_blank\"></a>";
590 responseString = responseString + "</div>"; 581 responseString += "</div>";
591 582
592 responseString = responseString + "<div id=\"channelinfo\"> [$channel] | [$version]=[$lang]</div>"; 583 responseString += "<div id=\"channelinfo\"> [$channel] | [$version]=[$lang]</div>";
593 responseString = responseString + "</form>"; 584 responseString += "</form>";
594 responseString = responseString + "<script language=\"JavaScript\">"; 585 responseString += "<script language=\"JavaScript\">";
595 responseString = responseString + "document.getElementById('firstname_input').focus();"; 586 responseString += "document.getElementById('firstname_input').focus();";
596 responseString = responseString + "</script>"; 587 responseString += "</script>";
597 responseString = responseString + "</div>"; 588 responseString += "</div>";
598 responseString = responseString + "</div>"; 589 responseString += "</div>";
599 responseString = responseString + "</body>"; 590 responseString += "</body>";
600 responseString = responseString + "</html>"; 591 responseString += "</html>";
601 return responseString; 592 return responseString;
602 } 593 }
603 594
@@ -611,7 +602,6 @@ namespace OpenSim.Framework.UserManagement
611 return m_userManager.CommitAgent(ref profile); 602 return m_userManager.CommitAgent(ref profile);
612 } 603 }
613 604
614
615 /// <summary> 605 /// <summary>
616 /// Checks a user against it's password hash 606 /// Checks a user against it's password hash
617 /// </summary> 607 /// </summary>
@@ -638,7 +628,7 @@ namespace OpenSim.Framework.UserManagement
638 //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); 628 //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password);
639 629
640 passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) 630 passwordSuccess = (profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
641 || profile.passwordHash.Equals(password,StringComparison.InvariantCultureIgnoreCase)); 631 || profile.passwordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
642 632
643 return passwordSuccess; 633 return passwordSuccess;
644 } 634 }
@@ -699,7 +689,6 @@ namespace OpenSim.Framework.UserManagement
699 buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; 689 buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
700 buddyitem.BuddyRightsGiven = (int) fl.FriendPerms; 690 buddyitem.BuddyRightsGiven = (int) fl.FriendPerms;
701 buddylistreturn.AddNewBuddy(buddyitem); 691 buddylistreturn.AddNewBuddy(buddyitem);
702
703 } 692 }
704 return buddylistreturn; 693 return buddylistreturn;
705 } 694 }