<commit_before><?php

defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Example
 *
 * This is an example of a few basic user interaction methods you could use
 * all done with a hardcoded array.
 *
 * @package		CodeIgniter
 * @subpackage	Rest Server
 * @category	Controller
 * @author		<NAME>
 * @link		http://philsturgeon.co.uk/code/
 */
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH . '/libraries/REST_Controller.php';

class User extends REST_Controller
{

    function __construct()
    {
        // Construct our parent class
        parent::__construct();
        $this->load->model('User_model');
        $this->load->model('Key_model');
    }

    public function signup_post()
    {
        $employee_id = $this->post('employee_id');
        $date_of_birth = $this->post('date_of_birth');
        $date_of_join = $this->post('date_of_join');
        if (!empty($employee_id) && !empty($date_of_birth) && !empty($date_of_join))
        {
            $user_details = $this->User_model->get_user_by_employee_details($employee_id, $date_of_birth, $date_of_join);
            if (!empty($user_details) && !empty($user_details[0]))
            {
                $user_details = $user_details[0];
                $user_id = $user_details->id;
                $key = $this->rest->key;
                $update_data['user_id'] = $user_id;
                $this->Key_model->update_key_details($key, $update_data);
                $this->response(array('result_code' => 200, 'result_title' => 'Success',
                    'result_string' => 'Success', 'user' => $user_details));
            }
            else
            {
                $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Invalid employee details.'));
            }
        }
        else
        {
            $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Please provide employee details.'));
        }
    }

    public function login_post()
    {
        $key = $this->rest->key;
        $employee_id = $this->post('employee_id');
        $password = $this->post('password');
        if (!empty($employee_id) && !empty($password))
        {
            $user_details = $this->User_model->get_user_by_employee_id($employee_id);
            if (isset($user_details['0']) && !empty($user_details['0']))
            {
                $user = $user_details['0'];
                $password_md5 = $<PASSWORD>;
                if ($password_md5 == md5($password))
                {
                    $update_data['user_id'] = $user->id;
                    $this->Key_model->update_key_details($key, $update_data);
                    $this->response(array('result_code' => 200, 'result_title' => 'Success', 'user' => $user_details));
                }
                else
                {
                    $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Invalid employee details!'));
                }<commit_msg>changed the user reponse<commit_after><?php

defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Example
 *
 * This is an example of a few basic user interaction methods you could use
 * all done with a hardcoded array.
 *
 * @package		CodeIgniter
 * @subpackage	Rest Server
 * @category	Controller
 * @author		<NAME>
 * @link		http://philsturgeon.co.uk/code/
 */
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH . '/libraries/REST_Controller.php';

class User extends REST_Controller
{

    function __construct()
    {
        // Construct our parent class
        parent::__construct();
        $this->load->model('User_model');
        $this->load->model('Key_model');
    }

    public function signup_post()
    {
        $employee_id = $this->post('employee_id');
        $date_of_birth = $this->post('date_of_birth');
        $date_of_join = $this->post('date_of_join');
        if (!empty($employee_id) && !empty($date_of_birth) && !empty($date_of_join))
        {
            $user_details = $this->User_model->get_user_by_employee_details($employee_id, $date_of_birth, $date_of_join);
            if (!empty($user_details) && !empty($user_details[0]))
            {
                $user_details = $user_details[0];
                $user_id = $user_details->id;
                $key = $this->rest->key;
                $update_data['user_id'] = $user_id;
                $this->Key_model->update_key_details($key, $update_data);
                $this->response(array('result_code' => 200, 'result_title' => 'Success',
                    'result_string' => 'Success', 'user' => $user_details));
            }
            else
            {
                $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Invalid employee details.'));
            }
        }
        else
        {
            $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Please provide employee details.'));
        }
    }

    public function login_post()
    {
        $key = $this->rest->key;
        $employee_id = $this->post('employee_id');
        $password = $this->post('password');
        if (!empty($employee_id) && !empty($password))
        {
            $user_details = $this->User_model->get_user_by_employee_id($employee_id);
            if (isset($user_details['0']) && !empty($user_details['0']))
            {
                $user = $user_details['0'];
                $password_md5 = $user->password;
                if ($password_md5 == md5($password))
                {
                    $update_data['user_id'] = $user->id;
                    $this->Key_model->update_key_details($key, $update_data);
                    $this->response(array('result_code' => 200, 'result_title' => 'Success', 'user' => $user));
                }
                else
                {
                    $this->response(array('result_code' => 400, 'result_title' => 'Error', 'result_string' => 'Invalid employee details!'));
                }
{'fraction_non_alphanumeric': 0.1538212958474713, 'fraction_numerical': 0.007432541606075295, 'mean_word_length': 2.225638353309015, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 95, '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': '507007', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1794, 'n_words': 343}