You are here

function genpass_form_user_register_form_alter in Generate Password 7.2

Implements hook_form_FORM_ID_alter().

File

./genpass.module, line 11
Genpass module: automatically sets strong passwords.

Code

function genpass_form_user_register_form_alter(&$form, &$form_state) {

  // This form structure only exists for admin creation.
  if (isset($form['account']['pass'])) {
    $form['account']['pass']['#access'] = FALSE;
    $form['account']['pass']['#type'] = 'value';
    $form['account']['genpass_message'] = array(
      '#type' => 'markup',
      '#markup' => t("<h3>Password</h3><p>A strong password will be generated automatically. The user should use the password reset function to set their password.</p>"),
    );

    // Add validation function, where password is actually set.
    $form['#validate'][] = 'genpass_admin_create_validate';
  }
}