user_pass_validate

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/user/user.pages.inc, строка 43

Версии
5
user_pass_validate($form_id, $form_values)
6
user_pass_validate($form, &$form_state)

Код

<?php
function user_pass_validate($form, &$form_state) {
  $name = trim($form_state['values']['name']);
  
  // Blocked accounts cannot request a new password,
  // check provided username and email against access rules.
  if (drupal_is_denied('user', $name) || drupal_is_denied('mail', $name)) {
    form_set_error('name', t('%name is not allowed to request a new password.', array('%name' => $name)));
  }

  // Try to load by email.
  $account = user_load(array('mail' => $name, 'status' => 1));
  if (!$account) {
    // No success, try to load by name.
    $account = user_load(array('name' => $name, 'status' => 1));
  }
  if (isset($account->uid)) {
    form_set_value(array('#parents' => array('account')), $account, $form_state);
  }
  else {
    form_set_error('name', t('Sorry, %name is not recognized as a user name or an e-mail address.', array('%name' => $name)));
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему