You are here

function user_profile_form_validate in Drupal 6

Same name and namespace in other branches
  1. 7 modules/user/user.pages.inc \user_profile_form_validate()

Validation function for the user account and profile editing form.

1 string reference to 'user_profile_form_validate'
user_edit_form in modules/user/user.module

File

modules/user/user.pages.inc, line 273
User page callback file for the user module.

Code

function user_profile_form_validate($form, &$form_state) {
  user_module_invoke('validate', $form_state['values'], $form_state['values']['_account'], $form_state['values']['_category']);

  // Validate input to ensure that non-privileged users can't alter protected data.
  if (!user_access('administer users') && array_intersect(array_keys($form_state['values']), array(
    'uid',
    'init',
    'session',
  )) || !user_access('administer permissions') && isset($form_state['values']['roles'])) {
    watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);

    // set this to a value type field
    form_set_error('category', t('Detected malicious attempt to alter protected user fields.'));
  }
}