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

class Welcome extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	 public function __construct()
	{
	    header('Access-Control-Allow-Origin: http://localhost');
	    header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
	    header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
	    parent::__construct();
	}
	public function login()
	{
	    $data_json = json_decode(file_get_contents('php://input'),true);
	    //var_dump($data_json['user_email']);die;
		//Cargamos los modelos
		// $this->load->model('UserModel');
		// $this->load->model('TokenGenerator');
		$user_email = $data_json["user_email"];
		$user_password =$data_json['user_password'];

		echo $user_email;
		echo $user_password;
		die;
	}
	public function index()
	{
		$this->load->view('welcome_message');
	}
}
