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]
  • #826 / Mar 18, 2011 1:14am

    Civic

    6 posts

    Hi Ben. I used your library in one of our web application. We are currently using one proxy when accessing websites. We are having problems on getting the current user logged in. Sometimes I get the wrong username when both of us access the same page. $user = I used
    $this->ion_auth->get_user();
    echo substr($user->email,0,strpos($user->email,’@’,1));

    Any help will be greatly appreciated.

    Thanks
    Civic

  • #827 / Mar 18, 2011 1:17am

    Ben Edmunds

    812 posts

    Civic,

    get_user without any parameters retrieves the ID from the session.  You could also pass the id like ion_auth->get_user($user_id).

    I’m not sure why you included that substr?

  • #828 / Mar 18, 2011 1:23am

    Civic

    6 posts

    Wow! that was a fast reply. How do I get the currently logged in userid? The substr was to get the username from email. I used the default setup. when you login I use the email address.
    Here is what I could try.

    $userid = $this->session->userdata(‘email’);
    $user = $this->ion_auth->get_user($userid);

    I will update you the results

    Thanks,

  • #829 / Mar 18, 2011 1:27am

    Ben Edmunds

    812 posts

    Civic,

    If you having issues with getting the correct currently logged in user using $this->ion_auth->get_user() then something is up with the session.  Read up on the CI Session library and see what you can troubleshoot. 

    BTW, user->id and user->email and not the same.  Also, you can get the user’s username with $user->username.

  • #830 / Mar 18, 2011 3:42am

    Civic

    6 posts

    Hi Ben,

    We were able to fix the problem. This is the case of 1 proxy server many users 1 session.
    We just put in line 102 in ion_auth.php library.

    # Handle proxy common session 2011-03-18
    session_start();

    Thank you so much.
    Hope this helps.

    Civic

  • #831 / Mar 18, 2011 4:07am

    Oliver Zeyen

    4 posts

    Hi Ben! Thanks for the fast reply!

    In my application controller: load ion_auth and call $this->ion_auth->get_userdata(); php gives me the following error…

    this was a typo… I actually call $this->ion_auth->get_user() and the error is thrown.

    Oliver

  • #832 / Mar 18, 2011 5:37am

    Oliver Zeyen

    4 posts

    Hey Ben!

    I’ve started a vanilla installation of ci 2.0.1 with the latest modular extension running properly. I’m able to load modules. I dont use any extended controllers. just the plain welcome_controller.php.

    ion_auth is now installed as a simple library, not as a module which somehow was a compromise, because i thought this would help in my case. in fact i prefer the library method.

    session and database are autoloaded. ion_auth is loadad and invoked in the welcome controller. same problem here.

    class Welcome extends CI_Controller {
    
        
        public function index()
        {
            $this->load->library('ion_auth');
                    #var_dump($this->ion_auth->get_user()); // Cool! Userdata returned
            $this->load->module('navigation'); // load my module as needed
            $navigation = $this->navigation->get_navigation(); // get my navigation
            #var_dump($this->ion_auth->get_user()); // Bad! 
    
            $this->load->view('welcome_message');
        }
    }

    I’ve attached a screenshot of the error message. There seems to ba a problem with the magic __get function in core/Model.php, too.

    Thanks for your help!

  • #833 / Mar 18, 2011 10:32am

    jk215

    8 posts

    jk215,

    Are you still having this issue?

    Yes. Basically the only steps Ive taken were to change the CONFIG option to ‘username’ and attempt to login using the default /auth/login.

  • #834 / Mar 18, 2011 11:48am

    Ben Edmunds

    812 posts

    Oliver,

    Are you loading Ion Auth in the parent class?  For example, if you are extending a bunch of classes but your most parent class in MY_Controller, load Ion Auth there.

  • #835 / Mar 18, 2011 11:49am

    Ben Edmunds

    812 posts

    Oliver,

    Also make sure you’re using the newest Ion Auth from github.

  • #836 / Mar 18, 2011 3:27pm

    isachi

    1 posts

    great library 😊

  • #837 / Mar 18, 2011 4:17pm

    Metlhead723

    2 posts

    I downloaded your Ion Auth package for Code Igniter the other day and I didn’t see a controller listed to handle “edit_user.php”. Do you have that code?...or am I missing something to see that view? Please get back to me when you can. Thanks!

  • #838 / Mar 18, 2011 6:04pm

    Oliver Zeyen

    4 posts

    Hi Ben!

    Everything works fine now!! It seems really important to use the “MY_Controller” in combination with modular extensions, if you want to use the this->load->module() or module::run method to access modules on runtime. (As the Manual says 😉... My fault!)

    If you access your modules by uri like a “normal” controller, ion_auth works without any problems.

    So in my case:

    Load ion_auth inside the My_Controller and extend EVERY Controller from this one… Or just autoload it! Bingo!

    Thanks for your help! Your library rocks!

    Oliver

  • #839 / Mar 19, 2011 12:01pm

    Ben Edmunds

    812 posts

    Glad to help Oliver.

  • #840 / Mar 19, 2011 12:02pm

    Ben Edmunds

    812 posts

    Metlhead723,

    I just emailed you back (assuming it was you).  There isn’t a ready made example for that, the code there is just to be used as an example so you can make your own.

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

ExpressionEngine News!

#eecms, #events, #releases