Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.7 KiB

  1. function GetText(oTextInput)
  2. {
  3. // Read the value and strip leading & trailing whitespace
  4. var szValue = oTextInput.value;
  5. return szValue ? szValue.replace(/^\s+|\s+$/g,"") : '';
  6. }
  7. function IsDuplicateName(szName, fnGetName)
  8. {
  9. var szNameLower = szName.toLowerCase();
  10. // Always check the Administrator name
  11. var szAdmin = top.window.GetAdminName();
  12. if (szAdmin.toLowerCase() == szNameLower)
  13. return szAdmin;
  14. var oUserList = top.window.g_oUserList;
  15. var cUsers = oUserList.length;
  16. for (var i = 0; i < cUsers; i++)
  17. {
  18. var szCompare = fnGetName(oUserList(i));
  19. if (szCompare.toLowerCase() == szNameLower)
  20. return szCompare;
  21. }
  22. return null;
  23. }
  24. function GetUserLoginName(oUser)
  25. {
  26. return oUser.setting("LoginName");
  27. }
  28. function IsDuplicateLoginName(szName)
  29. {
  30. return IsDuplicateName(szName,GetUserLoginName);
  31. }
  32. function IsDuplicateDisplayName(szName)
  33. {
  34. return IsDuplicateName(szName,top.window.GetUserDisplayName);
  35. }
  36. function ValidateAccountName(szName)
  37. {
  38. //
  39. // Invalid chars are /\[]":;|<>+=,?*@
  40. //
  41. // Names like "COM1" and "PRN", with any extension, are invalid.
  42. //
  43. var szMsg = null;
  44. var szDuplicate = IsDuplicateDisplayName(szName);
  45. if (szDuplicate)
  46. szMsg = top.window.L_AccountExists_ErrorMessage.replace(/%1/g,szDuplicate);
  47. else if (-1 != szName.search(/[]/\\\[":;\|<>\+=,\?\*@]/))//"
  48. szMsg = top.window.L_NameNotValid_ErrorMessage;
  49. else if (-1 != szName.toLowerCase().search(/^(aux|com[1-9]|con|lpt[1-9]|nul|prn)(\.|$)/))
  50. szMsg = top.window.L_DOSName_ErrorMessage;
  51. return szMsg;
  52. }