You are here

function legal_login_validate in Legal 7.2

Same name and namespace in other branches
  1. 5 legal.module \legal_login_validate()
  2. 6.8 legal.module \legal_login_validate()
  3. 6.7 legal.module \legal_login_validate()
  4. 7 legal.module \legal_login_validate()

File

./legal.module, line 688
Module file for Legal.

Code

function legal_login_validate($form, &$form_state) {
  $result = db_select('users', 'u')
    ->fields('u')
    ->condition('uid', $form_state['values']['uid'])
    ->range(0, 1)
    ->execute()
    ->fetchAllAssoc('uid');
  $account = array_pop($result);
  $hash = user_pass_rehash($account->pass, $form_state['values']['token'], $account->login, $form_state['values']['uid']);
  if ($hash !== $form_state['values']['hash']) {
    form_set_error('legal_accept', t('User ID cannot be identified.'));
    user_cookie_delete('legal_hash');
    user_cookie_delete('legal_id');
    drupal_goto();
  }
}