You are here

function genpass_admin_edit_validate in Generate Password 7.2

Form validate function to optionally set a password value.

1 string reference to 'genpass_admin_edit_validate'
genpass_form_user_profile_form_alter in ./genpass.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function genpass_admin_edit_validate($form, &$form_state) {
  if (!empty($form_state['values']['genpass_generate'])) {
    $password = genpass_genpass();

    // If the site wants to show the password, show it.
    if (variable_get('genpass_display_password', FALSE)) {
      drupal_set_message(t('Automatically generated a password %password for this user.', array(
        '%password' => $password,
      )));
    }
    form_set_value($form['account']['pass'], $password, $form_state);
  }
  return $form;
}