<commit_before><?php

class User extends BS_Controller {

  public function login() {
    $result = $this->authenticate();
    $this->session->set_userdata('last_page', $result['last_page']);
    //save last page, just add userdata to session and go back to last page. If failed, go to failure page and keep last page saved for when they succeed or hit back.
    if ($result['logged_in']) {
      $this->session->set_userdata('bookswap_user', $result['userdata']);
    } else {
      $this->session->set_flashdata('headernotice', "Invalid username/password");
    }
    redirect($result['last_page']);
  }

  public function logout() {
    $this->session->sess_destroy();
    redirect(base_url() . 'index.php');
  }

  public function authenticate(){
    $my_result = array(
      'logged_in' => FALSE,
      'last_page' => $this->input->post('current_page'),
    );
    if ($this->input->post('login')) {
      $netid = $this->input->post('username');
      $my_result['logged_in'] = TRUE;
      $my_result['userdata'] = $this->get_user($netid);
      if ($my_result['userdata']) {
        $my_result['userdata'] = $my_result['userdata'][0];
      } else {
        $newuser = array(
          'netid' => $netid,
          'name' => '<NAME>',
          'email' => '<EMAIL>',
          'first_name' => 'John',
        );
        $this->add_user($newuser);
        $my_result['userdata'] = $this->get_user($netid);
        if ( ! $my_result['userdata']) {
          return FALSE;
        }
      }
    }
    return $my_result;
  }

}<commit_msg>Removed "name" column from users table<commit_after><?php

class User extends BS_Controller {

  public function login() {
    $result = $this->authenticate();
    $this->session->set_userdata('last_page', $result['last_page']);
    //save last page, just add userdata to session and go back to last page. If failed, go to failure page and keep last page saved for when they succeed or hit back.
    if ($result['logged_in']) {
      $this->session->set_userdata('bookswap_user', $result['userdata']);
    } else {
      $this->session->set_flashdata('headernotice', "Invalid username/password");
    }
    redirect($result['last_page']);
  }

  public function logout() {
    $this->session->sess_destroy();
    redirect(base_url() . 'index.php');
  }

  public function authenticate(){
    $my_result = array(
      'logged_in' => FALSE,
      'last_page' => $this->input->post('current_page'),
    );
    if ($this->input->post('login')) {
      $netid = $this->input->post('username');
      $my_result['logged_in'] = TRUE;
      $my_result['userdata'] = $this->get_user($netid);
      if ($my_result['userdata']) {
        $my_result['userdata'] = $my_result['userdata'][0];
      } else {
        $newuser = array(
          'netid' => $netid,
          'email' => '<EMAIL>',
          'first_name' => 'John',
        );
        $this->add_user($newuser);
        $my_result['userdata'] = $this->get_user($netid);
        if ( ! $my_result['userdata']) {
          return FALSE;
        }
      }
    }
    return $my_result;
  }

}
{'fraction_non_alphanumeric': 0.17818889970788704, 'fraction_numerical': 0.0006491398896462187, 'mean_word_length': 2.8767295597484277, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3200113', 'n_tokens_mistral': 996, 'n_tokens_neox': 987, 'n_words': 203}