-1

enter image description here

How do I remove/disable "Passwords match:" text in Drupal 8.

2 Answers 2

3

This will remove passwords match and add placeholders if you want...

/**
 * Implements hook_form_FORM_ID_alter().
 * user_form
 */
function hook_form_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['account']['pass']['#process'][] = 'form_user_reset_process_pass';    
}

/**
 * Process password fields.
 *
 * @param $element
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 * @param $complete_form
 *
 * @return mixed
 */
function form_user_edit_process_pass(&$element, \Drupal\Core\Form\FormStateInterface $form_state, &$complete_form) {
  $element = \Drupal\Core\Render\Element\PasswordConfirm::processPasswordConfirm($element, $form_state, $complete_form);
  $element['pass1']['#placeholder'] = t('Password');
  $element['pass2']['#placeholder'] = t('Confirm password');
  return $element;
}
0
-1

CSS solution

.js-password-confirm-message {
  visibility: hidden;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.