Welcome Guest, Not a member yet? Register   Sign In
Why is mysite.com/user = mysite.com/user/user/login_process after bad login?
#1

[eluser]Anna_FL[/eluser]
Hi all,

Greatly appreicate any help.

EDIT: Using this from the Userguide as my .htaccess:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I have a User controller that has a login form.

After a "bad" login, I'm being redirected to my "login_process" function in the User controller but with this as the URL:

mysite.com/user/user/login_process

I've tried a failed login to "else" with different redirect URIs (slash, no slash, etc.) and now trying $this->index. None seem to work, it keeps adding the "/user/login_process" to my URL and I want it just to go back to the login form.

I'm also not getting any form_validation errors no matter how much I post the <?php echo validation_errors(); ?> in the form view.

Code:
<?php class User extends CI_Controller {
    
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('cookie');

     }  // End __construct function

    public function index()
    {
        $data['page_tagline'] = "Intramural sports signup";
        $data['content'] = $this->load->view('forms/user_login_form', '', true);
        
        $this->load->view('base', $data);

    }  // End Index function
    
    public function login_process()
    {
        $this->load->library('form_validation');
        
        $this->form_validation->set_rules('email','Email','trim|required|email');
        $this->form_validation->set_rules('password','Password','trim|required');
        
        if($this->input->post('login'))
        {
            if($this->form_validation->run())
            {
                $email = $this->input->post('email', TRUE);
                $this->load->model('User_model');
                $valid_user = $this->User_model->validate_user();
                
                if($valid_user == "Found")
                {
                    $this->input->set_cookie('mysite_user', $email, '120');
                    
                    $data['page_tagline'] = $email."'s sports data";
                    $data['content'] = $this->load->view('forms/user_sports_form', '', true);
                    
                    $this->load->view('base', $data);
                }
                else
                {
                    $this-index();
                }
            }
            
        }
        
        } // end login_process function




Theme © iAndrew 2016 - Forum software by © MyBB