1 user.module user_pass_required_validate($element, &$form_state, $form)

Element validate handler for the password field.

Set a default value if one-time login link goes out, set a form error if not and password value is empty.

File

core/modules/user/user.module, line 345
Enables the user registration and login system.

Code

function user_pass_required_validate($element, &$form_state, $form) {
  $values = $form_state['values'];
  if ($values['notify'] == 1) {
    $form_state['values']['pass'] = user_password(22);
  }
  else {
    if (empty($values['pass']) && $values['pass'] !== '0') {
      $message = t('!name field is required.', array('!name' => $element['#title']));
      form_set_error('pass', $message);
    }
  }
}