aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserAccountService/UserAccountService.cs
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-29 01:07:19 -0700
committerTom Grimshaw2010-05-29 01:07:19 -0700
commit3a5d379db840570b4a759afc1f51ff82e61a5887 (patch)
treebef5b2e8149a89d49e38e9e8cfbbb48e0fa0db29 /OpenSim/Services/UserAccountService/UserAccountService.cs
parentStop IGridService from throwing a fatal exception when an IPEndPoint cannot b... (diff)
parentGet the user's DOB back from the server response properly. (diff)
downloadopensim-SC_OLD-3a5d379db840570b4a759afc1f51ff82e61a5887.zip
opensim-SC_OLD-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.gz
opensim-SC_OLD-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.bz2
opensim-SC_OLD-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/UserAccountService/UserAccountService.cs')
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs89
1 files changed, 49 insertions, 40 deletions
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 6923293..eb588f0 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
277 #endregion 277 #endregion
278 278
279 #region Console commands 279 #region Console commands
280
280 /// <summary> 281 /// <summary>
281 /// Create a new user 282 /// Handle the create user command from the console.
282 /// </summary> 283 /// </summary>
283 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param> 284 /// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
284 protected void HandleCreateUser(string module, string[] cmdparams) 285 protected void HandleCreateUser(string module, string[] cmdparams)
@@ -304,6 +305,52 @@ namespace OpenSim.Services.UserAccountService
304 email = MainConsole.Instance.CmdPrompt("Email", ""); 305 email = MainConsole.Instance.CmdPrompt("Email", "");
305 else email = cmdparams[5]; 306 else email = cmdparams[5];
306 307
308 CreateUser(firstName, lastName, password, email);
309 }
310
311 protected void HandleResetUserPassword(string module, string[] cmdparams)
312 {
313 string firstName;
314 string lastName;
315 string newPassword;
316
317 if (cmdparams.Length < 4)
318 firstName = MainConsole.Instance.CmdPrompt("First name");
319 else firstName = cmdparams[3];
320
321 if (cmdparams.Length < 5)
322 lastName = MainConsole.Instance.CmdPrompt("Last name");
323 else lastName = cmdparams[4];
324
325 if (cmdparams.Length < 6)
326 newPassword = MainConsole.Instance.PasswdPrompt("New password");
327 else newPassword = cmdparams[5];
328
329 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
330 if (account == null)
331 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
332
333 bool success = false;
334 if (m_AuthenticationService != null)
335 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
336 if (!success)
337 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
338 firstName, lastName);
339 else
340 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
341 }
342
343 #endregion
344
345 /// <summary>
346 /// Create a user
347 /// </summary>
348 /// <param name="firstName"></param>
349 /// <param name="lastName"></param>
350 /// <param name="password"></param>
351 /// <param name="email"></param>
352 public void CreateUser(string firstName, string lastName, string password, string email)
353 {
307 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); 354 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
308 if (null == account) 355 if (null == account)
309 { 356 {
@@ -338,7 +385,6 @@ namespace OpenSim.Services.UserAccountService
338 else 385 else
339 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", 386 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
340 firstName, lastName); 387 firstName, lastName);
341
342 } 388 }
343 else 389 else
344 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", 390 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
@@ -350,7 +396,6 @@ namespace OpenSim.Services.UserAccountService
350 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", 396 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
351 firstName, lastName); 397 firstName, lastName);
352 398
353
354 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName); 399 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
355 } 400 }
356 } 401 }
@@ -358,42 +403,6 @@ namespace OpenSim.Services.UserAccountService
358 { 403 {
359 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); 404 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
360 } 405 }
361 406 }
362 }
363
364 protected void HandleResetUserPassword(string module, string[] cmdparams)
365 {
366 string firstName;
367 string lastName;
368 string newPassword;
369
370 if (cmdparams.Length < 4)
371 firstName = MainConsole.Instance.CmdPrompt("First name");
372 else firstName = cmdparams[3];
373
374 if (cmdparams.Length < 5)
375 lastName = MainConsole.Instance.CmdPrompt("Last name");
376 else lastName = cmdparams[4];
377
378 if (cmdparams.Length < 6)
379 newPassword = MainConsole.Instance.PasswdPrompt("New password");
380 else newPassword = cmdparams[5];
381
382 UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
383 if (account == null)
384 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: No such user");
385
386 bool success = false;
387 if (m_AuthenticationService != null)
388 success = m_AuthenticationService.SetPassword(account.PrincipalID, newPassword);
389 if (!success)
390 m_log.ErrorFormat("[USER ACCOUNT SERVICE]: Unable to reset password for account {0} {1}.",
391 firstName, lastName);
392 else
393 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Password reset for user {0} {1}", firstName, lastName);
394 }
395
396 #endregion
397
398 } 407 }
399} 408}