ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Ion Auth - Lightweight Auth System based on Redux Auth 2

February 10, 2010 7:00pm

Subscribe [287]
  • #166 / Apr 13, 2010 12:30am

    Zen Savona

    9 posts

    I have a small problem with this. i am quite new to CI, but loving it so far. I installed it per the instructions on Github, and now when i try to access the auth controller from my browser it is redirecting me wrongly.

    my install is localhost/AGN, therefore to access the auth demo, i would go to localhost/AGN/auth. when i go there it redirects me to localhost/AGN/localhost/AGN/auth/login, if i manually go to localhost/AGN/auth/login i can enter my credentials but then it redirects me to localhost/AGN/localhost/AGN/auth/login again on submit.

    Hope you can help me fix this, as your tool looks extremely promising.

  • #167 / Apr 13, 2010 12:41am

    Ben Edmunds

    812 posts

    Zen,

    Does the standard welcome controller work properly?

  • #168 / Apr 13, 2010 12:54am

    Zen Savona

    9 posts

    Zen,

    Does the standard welcome controller work properly?


    Yes, the welcome controller works fine, but it is not the default controller to be displayed.

  • #169 / Apr 13, 2010 1:14am

    Ben Edmunds

    812 posts

    Zen,

    Check the redirects.

  • #170 / Apr 13, 2010 1:18am

    Zen Savona

    9 posts

    Thats the odd part, it all seems correct.

    function index() 
        {
            if (!$this->ion_auth->logged_in()) {
                //redirect them to the login page
                redirect('auth/login', 'refresh');
            }
            elseif (!$this->ion_auth->is_admin()) {
                //redirect them to the home page because they must be an administrator to view this
                redirect($this->config->item('base_url'), 'refresh');
            }
            else {
                //set the flash data error message if there is one
                $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
                
                //list the users
                $this->data['users'] = $this->ion_auth->get_users_array();
                $this->load->view('auth/index', $this->data);
            }
        }


    when i go to localhost/AGN/auth, because i am not logged in, it should redirect me to auth/login. which is localhost/AGN (base url)/auth/login


    ...makes no sense to me

  • #171 / Apr 13, 2010 1:24am

    Ben Edmunds

    812 posts

    Try

    redirect('/auth/login', 'refresh');
  • #172 / Apr 13, 2010 1:32am

    Zen Savona

    9 posts

    still redirects me to localhost/AGN/localhost/AGN/auth/login. could it have something to do with my .htaccess file removing the /index.php/ from my URLs? in my global config file i have this:

    $config['index_page'] = "";

    im going to try it on a clean CI install.

  • #173 / Apr 13, 2010 1:37am

    jayrulez

    96 posts

    still redirects me to localhost/AGN/localhost/AGN/auth/login. could it have something to do with my .htaccess file removing the /index.php/ from my URLs? in my global config file i have this:

    $config['index_page'] = "";

    im going to try it on a clean CI install.

    Seems you have http:// missing somewhere

  • #174 / Apr 13, 2010 1:38am

    Ben Edmunds

    812 posts

    Zen,

    Also check your base_url…

  • #175 / Apr 13, 2010 1:43am

    Zen Savona

    9 posts

    Zen,

    Also check your base_url…

    i have it -semi- working using a clean CI install, i conclude that it’s redirection does not like my non-CI mod_rewrite generated URLs. not exactly sure why though…

    it still redirects me to the base url when i log in, then i manually have to go back to /index.php/auth, im assuming it is built on the pretense that when using this test controller, it is the default controller?


    I think these problems can be overcome while just using it’s components.


    Thanks for the help.

  • #176 / Apr 13, 2010 1:47am

    Ben Edmunds

    812 posts

    No it doesn’t need to be the default controller.  Post your htaccess or you can see the one I use at http://github.com/benedmunds/CodeIgniter-Standard-Project/blob/master/.htaccess

  • #177 / Apr 13, 2010 1:49am

    Zen Savona

    9 posts

    No it doesn’t need to be the default controller.  Post your htaccess or you can see the one I use at http://github.com/benedmunds/CodeIgniter-Standard-Project/blob/master/.htaccess

    my .htaccess is as follows

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /AGN/
    
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /index.php?/$1 [L]
    
        RewriteCond %{REQUEST_URI} ^application.*
        RewriteRule ^(.*)$ /index.php?/$1 [L]
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
     
        ErrorDocument 404 /index.php
    </IfModule>
  • #178 / Apr 13, 2010 2:32am

    InsiteFX

    6819 posts

    Try changing this:
    RewriteBase /AGN/

    To this:
    RewriteBase /

    @Ben I think your right he is missing the http://
    I would check the base_url

    InsiteFX

  • #179 / Apr 13, 2010 2:41am

    Zen Savona

    9 posts

    Thanks everyone for your help. I fixed the problem.

    The project that i am using this for is just a little site for my own interest, and because i have done little groundwork, it is actually beneficial to me to work from Ben’s standard project template. works fine now, i imported all of my other code into there and everything is running smoothly.


    Once again i just want to say thanks 😊

  • #180 / Apr 13, 2010 11:15am

    Schumacher

    25 posts

    Thx for the help erliere.
    now ive gone to the next step, and that is the user creation.
    It seemed fine, but then something came up, and i know how to work around it, but i just want to make sure that there isn’t any other, smartere, way to do it.
    I want to check if the username and the email already exists, and i know i can make this with a callback function which just tells me true or false on the return. then ill make a error message for it.
    But is there any way easiere with this lovly library to do this ?
    Would be nice to have the 2 in one function, so i can use the same instead of making 2 functions doing almost the same thing.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases