You are here

function user_edit_validate in Drupal 4

Same name and namespace in other branches
  1. 5 modules/user/user.module \user_edit_validate()
  2. 6 modules/user/user.pages.inc \user_edit_validate()

File

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

Code

function user_edit_validate($form_id, $form_values) {
  user_module_invoke('validate', $form_values, $form_values['_account'], $form_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_values), array(
    'uid',
    'init',
    'session',
  )) || !user_access('administer access control') && isset($form_values['roles'])) {
    $message = t('Detected malicious attempt to alter protected user fields.');
    watchdog('security', $message, WATCHDOG_WARNING);

    // set this to a value type field
    form_set_error('category', $message);
  }
}