WordPress.org

Make WordPress Core

Ticket #18399: password.patch

File password.patch, 1.2 KB (added by jorbin, 3 years ago)
  • wp-admin/js/password-strength-meter.dev.js

     
    11// Password strength meter 
    22function passwordStrength(password1, username, password2) { 
    3         var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, mismatch = 5, symbolSize = 0, natLog, score; 
     3        var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, mismatch = 5, symbolSize = 0, natLog, score, rPassword; 
    44 
    55        // password 1 != password 2 
    66        if ( (password1 != password2) && password2.length > 0) 
     
    1414        if ( password1.toLowerCase() == username.toLowerCase() ) 
    1515                return badPass; 
    1616 
     17    // password (even 1337 passwords), should always be bad 
     18    rPassword = new RegExp( /p[a|4][s|5]{2}w[0|o]rd/i);                                                                                                                                                    
     19    if( rPassword.test( password1 ) === true && password1.length < 25 ) 
     20        return passwordStrengthResults.badPass; 
     21 
     22 
    1723        if ( password1.match(/[0-9]/) ) 
    1824                symbolSize +=10; 
    1925        if ( password1.match(/[a-z]/) )