function user_form_test_current_password

7.x user_form_test.module user_form_test_current_password($form, &$form_state, $account)

A test form for user_validate_current_pass().

1 string reference to 'user_form_test_current_password'
user_form_test_menu in drupal-7.x/modules/user/tests/user_form_test.module
Implements hook_menu().

File

drupal-7.x/modules/user/tests/user_form_test.module, line 28
Dummy module implementing a form to test user password validation

Code

function user_form_test_current_password($form, &$form_state, $account) {
  $account->user_form_test_field = '';
  $form['#user'] = $account;

  $form['user_form_test_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Test field'),
    '#description' => t('A field that would require a correct password to change.'),
    '#required' => TRUE,
  );

  $form['current_pass'] = array(
    '#type' => 'password',
    '#title' => t('Current password'),
    '#size' => 25,
    '#description' => t('Enter your current password'),
  );

  $form['current_pass_required_values'] = array(
    '#type' => 'value',
    '#value' => array('user_form_test_field' => t('Test field')),
  );

  $form['#validate'][] = 'user_validate_current_pass';
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Test'),
  );
  return $form;
}