[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/js/ -> password-verify.js (source)

   1  /* jshint undef: false */
   2  /* Password Verify */
   3  /* global pwsL10n */
   4  /* @since 3.0.0 */
   5  /* @version 8.0.0 */
   6  ( function( $ ){
   7      /**
   8       * Function to inform the user about the strength of its password.
   9       *
  10       * @deprecated since version 5.0.0.
  11       */
  12  	function check_pass_strength() {
  13          var pass1 = $( '.password-entry' ).val(),
  14              pass2 = $( '.password-entry-confirm' ).val(),
  15              strength;
  16  
  17          // Reset classes and result text.
  18          $( '#pass-strength-result' ).removeClass( 'show mismatch short bad good strong' );
  19          if ( ! pass1 ) {
  20              $( '#pass-strength-result' ).html( pwsL10n.empty );
  21              return;
  22          }
  23  
  24          // wp.passwordStrength.userInputBlacklist() has been deprecated in WP 5.5.0.
  25          if ( 'function' === typeof wp.passwordStrength.userInputDisallowedList ) {
  26              strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputDisallowedList(), pass2 );
  27          } else {
  28              strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 );
  29          }
  30  
  31          switch ( strength ) {
  32              case 2:
  33                  $( '#pass-strength-result' ).addClass( 'show bad' ).html( pwsL10n.bad );
  34                  break;
  35              case 3:
  36                  $( '#pass-strength-result' ).addClass( 'show good' ).html( pwsL10n.good );
  37                  break;
  38              case 4:
  39                  $( '#pass-strength-result' ).addClass( 'show strong' ).html( pwsL10n.strong );
  40                  break;
  41              case 5:
  42                  $( '#pass-strength-result' ).addClass( 'show mismatch' ).html( pwsL10n.mismatch );
  43                  break;
  44              default:
  45                  $( '#pass-strength-result' ).addClass( 'show short' ).html( pwsL10n['short'] );
  46                  break;
  47          }
  48      }
  49  
  50      // Bind check_pass_strength to keyup events in the password fields.
  51      $( function() {
  52          $( '.password-entry' ).val( '' ).keyup( check_pass_strength );
  53          $( '.password-entry-confirm' ).val( '' ).keyup( check_pass_strength );
  54  
  55          // Display a deprecated warning.
  56          console.warn( 'The bp-nouveau/js/password-verify.js script is deprecated since 5.0.0 and will be deleted in version 6.0.0.' );
  57      } );
  58  
  59  } )( jQuery );


Generated: Thu Dec 16 01:01:03 2021 Cross-referenced by PHPXref 0.7.1