home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / 01_03.iso / software / snpf / NPF / NPF.MSI / pcwiz.dll / HTML / WIZ-SETPASSWORD.JS < prev    next >
Encoding:
JavaScript  |  2002-09-21  |  3.6 KB  |  175 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    wiz-SetPasswords (Javascript file for wiz-SetPasswords.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. var m_iCurrentPage = 1;
  12.  
  13. var NOT_PRESENT =0;
  14. var PRESENT = 1;
  15. var PRESENT_FAKE=2;
  16.  
  17.  
  18. function GetCurrentUser()
  19. {
  20.  
  21.     UserName.innerText = window.parent.aAccounts[m_iCurrentPage - 1].m_sAccountName;
  22.  
  23.     // Set the user type
  24.     switch(window.parent.aAccounts[m_iCurrentPage - 1].m_iAccountType)
  25.     {
  26.     
  27.         case "0":
  28.             if(NisFetOHelper.State == PRESENT)
  29.             {
  30.                 UserType.innerText = "Restricted User";
  31.             }
  32.             else
  33.             {
  34.                 UserType.innerText = "Child";
  35.             }
  36.             break;
  37.  
  38.         case "1":
  39.             UserType.innerText = "Teenager";
  40.             break;
  41.  
  42.         case "2":
  43.             if(NisFetOHelper.State == PRESENT)
  44.             {
  45.                 UserType.innerText = "Standard User";
  46.             }
  47.             else
  48.             {
  49.                 UserType.innerText = "Adult";
  50.             }
  51.             break;
  52.  
  53.         case "3":
  54.             UserType.innerText = "Supervisor";
  55.             break;
  56.  
  57.         default:
  58.             UserType.innerText = "Error";
  59.     }
  60.  
  61. }
  62.  
  63. function SavePassword()
  64. {
  65.     window.parent.SetAccountInfo(m_iCurrentPage - 1, null, Pass.value, null);
  66.     
  67. }
  68.  
  69. function OnLoad()
  70. {
  71.  
  72.     // If no accounts were created we can skip the "Set Password" page by simulating "Next Click"
  73.     if (window.parent.m_iAccounts < 1)
  74.     {
  75.         window.parent.frames("bottom",0).GoNext("Set Password");    
  76.         
  77.     }
  78.     else
  79.     {
  80.         GetCurrentUser();    // Get First User
  81.         CurrentNum.innerText = m_iCurrentPage;
  82.         TotalNum.innerText = window.parent.m_iAccounts;
  83.     }
  84. }
  85.  
  86.  
  87. function Page_GoNext()
  88. {
  89.     
  90.     if (m_iCurrentPage < window.parent.m_iAccounts)
  91.     {
  92.         
  93.         // Check Password if it is valid 
  94.         if(Pass.value != PassConfirm.value)
  95.         {
  96.             alert("Password does not match confirmation");
  97.             return false;                
  98.         }
  99.  
  100.         // If password in empty pass in empty string
  101.         if(!Pass.value)
  102.         {
  103.             Pass.value = "";
  104.         }
  105.         
  106.         SavePassword();        // Save Password off            
  107.  
  108.         // Now update the page for next user
  109.         m_iCurrentPage++;                        // Increment "user" count 
  110.         CurrentNum.innerText = m_iCurrentPage;    // Update text that refers to user count
  111.         Pass.value = "";                        // Clear password fields
  112.         PassConfirm.value = "";
  113.         GetCurrentUser();                        // Get Next user info
  114.  
  115.         return false;    // Return False because we do not want to go "next" just yet
  116.     }
  117.     else
  118.     {
  119.         
  120.         // Check Last Password if it is valid 
  121.         if(Pass.value != PassConfirm.value)
  122.         {
  123.             alert("Password does not match confirmation");
  124.             return false;                
  125.         }
  126.  
  127.         // If password in empty pass in empty string
  128.         if(!Pass.value)
  129.         {
  130.             Pass.value = "";
  131.         }
  132.             
  133.         SavePassword();    // Save off last password
  134.         
  135.         // Now save off each account
  136.         for (i = 0; i < window.parent.m_iAccounts; i++)
  137.         {
  138.             // Now go ahead and create each account;
  139.             var name = window.parent.aAccounts[i].m_sAccountName;
  140.             
  141.             if(!name || name == "")
  142.                 name = " ";
  143.                                         
  144.             // call WrapUM to create this account
  145.             UserManager.CreateAccount(window.parent.aAccounts[i].m_sAccountName, 
  146.                         window.parent.aAccounts[i].m_sAccountPassword,
  147.                         window.parent.aAccounts[i].m_iAccountType);
  148.         }
  149.             
  150.  
  151.         return true;
  152.     }
  153.  
  154.  
  155. }
  156.  
  157.  
  158. function Page_GoBack()
  159. {
  160.     return true;
  161. }
  162.  
  163. function OnKeyDownHandler()
  164. {
  165.     // Last Control Tab over to the <back, next, close> button.
  166.     var VK_ESCAPE = 27;
  167.  
  168.     if (window.event.keyCode == VK_ESCAPE)
  169.     {
  170.         // Escape key.. We want to exit out of the wizard..
  171.         parent.window.navigate("res://closeme.xyz");
  172.  
  173.     }
  174.     
  175. }