Changeset 8114

Show
Ignore:
Timestamp:
08/23/09 21:54:04 (1 year ago)
Author:
p_lindheimer
Message:

weakpassword validation re #3581 and re #3266

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.6/amp_conf/htdocs/admin/common/script.js.php

    r7905 r8114  
    5656function validateSingleDestination(theForm,formNum,bRequired){var gotoType=theForm.elements['goto'+formNum].value;if(bRequired&&gotoType==''){alert('<?php echo _("Please select a \"Destination\""); ?>');return false;}else{if(gotoType=='custom'){var gotoFld=theForm.elements['custom'+formNum];var gotoVal=gotoFld.value;if(gotoVal.indexOf('custom-')==-1){alert('<?php echo _("Custom Goto contexts must contain the string \"custom-\".  ie: custom-app,s,1"); ?>');gotoFld.focus();return false;}}} 
    5757return true;} 
     58 
     59// Used on the extensions/devices page to make sure a strong password is used 
     60function weakSecret() 
     61{ 
     62  var password = document.getElementById('devinfo_secret').value; 
     63  var origional_password = document.getElementById('devinfo_secret_origional').value; 
     64 
     65  if (password == origional_password) 
     66  { 
     67    return false; 
     68  } 
     69 
     70  if (password.length <= 5) 
     71  { 
     72    alert('<?php echo _("The secret must be at minimum six characters in length."); ?>'); 
     73    return true; 
     74  } 
     75 
     76  if (password.match(/[a-z].*[a-z]/i) == null || password.match(/\d\D*\d/) == null) 
     77  { 
     78    alert('<?php echo _("The secret must contain at least two numbers and two letters."); ?>'); 
     79    return true; 
     80  } 
     81  return false; 
     82}