varbase_core-8.x-8.18/modules/varbase_security/varbase_security.module
modules/varbase_security/varbase_security.module
<?php /** * @file * Contains varbase_security.module. */ /** * Implements hook_form_FORM_ID_alter() for user_form(). */ function varbase_security_form_user_form_alter(&$form, &$form_state) { if (\Drupal::moduleHandler()->moduleExists('password_policy')) { if (isset($form['account']['password_policy_status'])) { // Hide the password policy status table. unset($form['account']['password_policy_status']); } } } /** * Implements hook_element_info_alter(). */ function varbase_security_element_info_alter(array &$types) { if (\Drupal::moduleHandler()->moduleExists('password_policy')) { if (isset($types['password_confirm'])) { if (isset($types['password_confirm']['#process'])) { // Hide the password confirm process. if ($key = array_search('password_policy_check_constraints_password_confirm_process', $types['password_confirm']['#process'])) { unset($types['password_confirm']['#process'][$key]); } } // Have the custom Varbase security user form process password confirm. $types['password_confirm']['#process'][] = 'varbase_security_user_form_process_password_confirm'; } } } /** * Varbase Security 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. */ function varbase_security_user_form_process_password_confirm($element) { // Get Drupal core user form process password confirm over the password. $element = user_form_process_password_confirm($element); // Update the too short message. $element['#attached']['drupalSettings']['password']['tooShort'] = t('Make it at least 6 characters'); // TODO: Convert _password_policy_constraints_validate to change drupal core. return $element; }