Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- /**
- * @author ralf
- * @desc Clase Login que contiene autenticación de usuarios
- * **/
- class Login extends CI_Controller{
- public function __construct(){
- parent::__construct();
- $this->load->model(array(
- 'ion_auth_model'
- ));
- $this->load->library(
- array(
- 'ion_auth'
- ));
- $this->load->helper(array('url','language'));
- //$this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
- $this->lang->load('auth');
- }
- public function index(){
- $this->load->helper(array('form', 'url'));
- $this->load->library('form_validation');
- //
- $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
- $this->form_validation->set_rules('inputEmail', 'E-Mail', 'required|trim|valid_email');
- $this->form_validation->set_rules('inputPassword', 'Password', 'required|trim');
- //
- if ($this->form_validation->run() == FALSE){
- $this->load->view("header/login");
- $this->load->view("templates/login");
- $this->load->view("footer/footer_login");
- }else{
- //TRUE del formulario
- $this->input->post('peso');
- $this->input->post('peso');
- $remember = TRUE;
- if($this->ion_auth->login($this->input->post('inputEmail'), $this->input->post('inputPassword'),$remember)){
- redirect('imc/index', 'refresh');
- }else{
- $datos['message'] = "Error, usuario o contraseña incorrecta";
- $this->load->view("header/login");
- $this->load->view("templates/login", $datos);
- $this->load->view("footer/footer_login");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement