aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.UserServer/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenGridServices.UserServer/Main.cs61
1 files changed, 36 insertions, 25 deletions
diff --git a/OpenGridServices.UserServer/Main.cs b/OpenGridServices.UserServer/Main.cs
index 999d446..9c128d3 100644
--- a/OpenGridServices.UserServer/Main.cs
+++ b/OpenGridServices.UserServer/Main.cs
@@ -99,6 +99,39 @@ namespace OpenGridServices.UserServer
99 _httpd = new UserHTTPServer(); 99 _httpd = new UserHTTPServer();
100 } 100 }
101 101
102
103 public void do_create(string what)
104 {
105 switch(what)
106 {
107 case "user":
108 m_console.WriteLine("Creating new user profile");
109 string tempfirstname;
110 string templastname;
111 string tempMD5Passwd;
112
113 tempfirstname=m_console.CmdPrompt("First name: ");
114 templastname=m_console.CmdPrompt("Last name: ");
115 tempMD5Passwd=m_console.PasswdPrompt("Password: ");
116
117 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
118 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
119 bs = x.ComputeHash(bs);
120 System.Text.StringBuilder s = new System.Text.StringBuilder();
121 foreach (byte b in bs)
122 {
123 s.Append(b.ToString("x2").ToLower());
124 }
125 tempMD5Passwd = s.ToString();
126
127 UserProfile newuser=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
128 newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
129 newuser.homepos = new LLVector3(128f,128f,23f);
130 _profilemanager.SaveUserProfiles();
131 break;
132 }
133 }
134
102 public void RunCmd(string cmd, string[] cmdparams) 135 public void RunCmd(string cmd, string[] cmdparams)
103 { 136 {
104 switch (cmd) 137 switch (cmd)
@@ -108,31 +141,9 @@ namespace OpenGridServices.UserServer
108 m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)"); 141 m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)");
109 break; 142 break;
110 143
111 case "create user": 144 case "create":
112 m_console.WriteLine("Creating new user profile"); 145 do_create(cmdparams[0]);
113 string tempfirstname; 146 break;
114 string templastname;
115 string tempMD5Passwd;
116
117 tempfirstname=m_console.CmdPrompt("First name: ");
118 templastname=m_console.CmdPrompt("Last name: ");
119 tempMD5Passwd=m_console.PasswdPrompt("Password: ");
120
121 System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
122 byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
123 bs = x.ComputeHash(bs);
124 System.Text.StringBuilder s = new System.Text.StringBuilder();
125 foreach (byte b in bs)
126 {
127 s.Append(b.ToString("x2").ToLower());
128 }
129 tempMD5Passwd = "$1$" + s.ToString();
130
131 UserProfile newuser=_profilemanager.CreateNewProfile(tempfirstname,templastname,tempMD5Passwd);
132 newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
133 newuser.homepos = new LLVector3(128f,128f,23f);
134 _profilemanager.SaveUserProfiles();
135 break;
136 147
137 case "shutdown": 148 case "shutdown":
138 m_console.Close(); 149 m_console.Close();