user_form_process_password_confirm($element)
Form element process handler for client-side password validation.
This #process handler is automatically invoked for 'password_confirm' form elements to add the JavaScript and string translations for dynamic password validation.
File
- core/modules/user/user.module, line 1240
- Enables the user registration and login system.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | function user_form_process_password_confirm( $element ) { $password_settings = array ( 'confirmTitle' => t( 'Passwords match:' ), 'confirmSuccess' => t( 'yes' ), 'confirmFailure' => t( 'no' ), 'showStrengthIndicator' => FALSE, ); if (\Drupal::config( 'user.settings' )->get( 'password_strength' )) { $password_settings [ 'showStrengthIndicator' ] = TRUE; $password_settings += array ( 'strengthTitle' => t( 'Password strength:' ), 'hasWeaknesses' => t( 'Recommendations to make your password stronger:' ), 'tooShort' => t( 'Make it at least 12 characters' ), 'addLowerCase' => t( 'Add lowercase letters' ), 'addUpperCase' => t( 'Add uppercase letters' ), 'addNumbers' => t( 'Add numbers' ), 'addPunctuation' => t( 'Add punctuation' ), 'sameAsUsername' => t( 'Make it different from your username' ), 'weak' => t( 'Weak' ), 'fair' => t( 'Fair' ), 'good' => t( 'Good' ), 'strong' => t( 'Strong' ), 'username' => \Drupal::currentUser()->getUsername(), ); } $element [ '#attached' ][ 'library' ][] = 'user/drupal.user' ; $element [ '#attached' ][ 'drupalSettings' ][ 'password' ] = $password_settings ; return $element ; } |
Please login to continue.