Ticket #3581: script.js.php.patch

File script.js.php.patch, 1.0 kB (added by jjshoe, 3 years ago)
  • script.js.php

    old new  
    5050   
    5151  return true; 
    5252} 
     53 
     54// Used on the extensions/devices page to make sure a strong password is used 
     55function weakSecret() 
     56{ 
     57        var password = document.getElementById('devinfo_secret').value; 
     58        var origional_password = document.getElementById('devinfo_secret_origional').value; 
     59 
     60        if (password == origional_password) 
     61        { 
     62                return false; 
     63        } 
     64 
     65        if (password.length <= 5) 
     66        { 
     67                alert('<?php echo _("The secret must be at minimum six characters in length."); ?>'); 
     68                return true; 
     69        } 
     70 
     71        if (password.match(/[a-z].*[a-z]/i) == null || password.match(/\d\D*\d/) == null) 
     72        { 
     73                alert('<?php echo _("The secret must contain at least two numbers and two letters."); ?>'); 
     74                return true; 
     75        } 
     76        return false; 
     77} 
     78