home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / 05_02.iso / software / nis / files / NIS / NIS.MSI / pcwiz.dll / HTML / WIZ-SETPASSWORD.JS < prev    next >
Encoding:
JavaScript  |  2001-12-01  |  3.3 KB  |  156 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.  
  14. function GetCurrentUser()
  15. {
  16.  
  17.     UserName.innerText = window.parent.aAccounts[m_iCurrentPage - 1].m_sAccountName;
  18.  
  19.     // Set the user type
  20.     switch(window.parent.aAccounts[m_iCurrentPage - 1].m_iAccountType)
  21.     {
  22.     
  23.         case "0":
  24.             UserType.innerText = "Child";
  25.             break;
  26.  
  27.         case "1":
  28.             UserType.innerText = "Teenager";
  29.             break;
  30.  
  31.         case "2":
  32.             UserType.innerText = "Adult";
  33.             break;
  34.  
  35.         case "3":
  36.             UserType.innerText = "Supervisor";
  37.             break;
  38.  
  39.         default:
  40.             UserType.innerText = "Error";
  41.     }
  42.  
  43. }
  44.  
  45. function SavePassword()
  46. {
  47.     window.parent.SetAccountInfo(m_iCurrentPage - 1, null, Pass.value, null);
  48.     
  49. }
  50.  
  51. function OnLoad()
  52. {
  53.     // If no accounts were created we can skip the "Set Password" page by simulating "Next Click"
  54.     if (window.parent.m_iAccounts < 1)
  55.     {
  56.         window.parent.frames("bottom",0).GoNext("Set Password");    
  57.         
  58.     }
  59.     else
  60.     {
  61.         GetCurrentUser();    // Get First User
  62.         CurrentNum.innerText = m_iCurrentPage;
  63.         TotalNum.innerText = window.parent.m_iAccounts;
  64.     }
  65. }
  66.  
  67.  
  68. function Page_GoNext()
  69. {
  70.     
  71.     if (m_iCurrentPage < window.parent.m_iAccounts)
  72.     {
  73.         
  74.         // Check Password if it is valid 
  75.         if(Pass.value != PassConfirm.value)
  76.         {
  77.             alert("Password does not match confirmation");
  78.             return false;                
  79.         }
  80.  
  81.         // If password in empty pass in empty string
  82.         if(!Pass.value)
  83.         {
  84.             Pass.value = "";
  85.         }
  86.         
  87.         SavePassword();        // Save Password off            
  88.  
  89.         // Now update the page for next user
  90.         m_iCurrentPage++;                        // Increment "user" count 
  91.         CurrentNum.innerText = m_iCurrentPage;    // Update text that refers to user count
  92.         Pass.value = "";                        // Clear password fields
  93.         PassConfirm.value = "";
  94.         GetCurrentUser();                        // Get Next user info
  95.  
  96.         return false;    // Return False because we do not want to go "next" just yet
  97.     }
  98.     else
  99.     {
  100.         
  101.         // Check Last Password if it is valid 
  102.         if(Pass.value != PassConfirm.value)
  103.         {
  104.             alert("Password does not match confirmation");
  105.             return false;                
  106.         }
  107.  
  108.         // If password in empty pass in empty string
  109.         if(!Pass.value)
  110.         {
  111.             Pass.value = "";
  112.         }
  113.             
  114.         SavePassword();    // Save off last password
  115.         
  116.         // Now save off each account
  117.         for (i = 0; i < window.parent.m_iAccounts; i++)
  118.         {
  119.             // Now go ahead and create each account;
  120.             var name = window.parent.aAccounts[i].m_sAccountName;
  121.             
  122.             if(!name || name == "")
  123.                 name = " ";
  124.                                         
  125.             // call WrapUM to create this account
  126.             UserManager.CreateAccount(window.parent.aAccounts[i].m_sAccountName, 
  127.                         window.parent.aAccounts[i].m_sAccountPassword,
  128.                         window.parent.aAccounts[i].m_iAccountType);
  129.         }
  130.             
  131.  
  132.         return true;
  133.     }
  134.  
  135.  
  136. }
  137.  
  138.  
  139. function Page_GoBack()
  140. {
  141.     return true;
  142. }
  143.  
  144. function OnKeyDownHandler()
  145. {
  146.     // Last Control Tab over to the <back, next, close> button.
  147.     var VK_ESCAPE = 27;
  148.  
  149.     if (window.event.keyCode == VK_ESCAPE)
  150.     {
  151.         // Escape key.. We want to exit out of the wizard..
  152.         parent.window.navigate("res://closeme.xyz");
  153.  
  154.     }
  155.     
  156. }