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]
  • #976 / Jun 26, 2011 2:29am

    dUspan

    39 posts

    Hi

    do you have a demo site for this app?thanks

    i really want to see how this work first :D thanks again.

  • #977 / Jun 30, 2011 12:26am

    kimo_gusatava

    25 posts

    is there a way to check if a passed ID is currently logged in?
    like:

    // url: <a href="http://example.com/user/profile/3213">http://example.com/user/profile/3213</a>
    
    function profile($id) {
        if(this->ion_auth->is_current_user($id)) {
            // show an editable profile
        } else {
            // show profile to public
        }
    
    }
  • #978 / Jun 30, 2011 1:06am

    adityamenon

    175 posts

  • #979 / Jun 30, 2011 1:32am

    kimo_gusatava

    25 posts

    hmmm I think i need to expand that further:

    public function is_current_user($id=false) {
            $user = $this->get_user($id);
            if(sizeof($user)>0) {
                return ($user->id == $this->ci->session->userdata("id") && $id ) ? true: false;
            } else {
                return false;
            }
        }

    so I can just call it like this :

    public function view($id) {
            if($this->ion_auth->is_current_user($id)) {
                // display profile with editing options or a dashed board;
            } else {
                // display as other users or a front page or anything else;
            }
            
            
        }
  • #980 / Jul 05, 2011 11:35am

    fima

    8 posts

    Hello people.
    I’am using Ion_auth in my project. And in project i want to not logout from site after i change user info.
    Help me solve this problem.

  • #981 / Jul 05, 2011 12:27pm

    adityamenon

    175 posts

    Hello people.
    I’am using Ion_auth in my project. And in project i want to not logout from site after i change user info.
    Help me solve this problem.

    Please expand?

    You would use this function to update a user’s information:
    http://benedmunds.com/ion_auth/#update_user

    There is no code in the Library or Model to log a user out after info was updated.

  • #982 / Jul 05, 2011 12:38pm

    defectivereject

    36 posts

    I THINK it logs you out if you change the password, as anything should

  • #983 / Jul 05, 2011 12:40pm

    fima

    8 posts

    Solve the problem, I do some changes in model and forgot delete it, now I delete it and everything work well

  • #984 / Jul 05, 2011 2:08pm

    CARP

    181 posts

    There is no code in the Library or Model to log a user out after info was updated.


    unless you do a 301 redirect using the url helper function redirect… it would need to be redirected to (“auth/logout”) in case logout function is in the original auth controller

  • #985 / Jul 06, 2011 11:41am

    Ben Edmunds

    812 posts

    Hey adityamenon,

    Just saw your changes to the pull request.  FYI - I’ll try to merge that in tonight or tomorrow.

  • #986 / Jul 13, 2011 8:54am

    maxrosecollins

    4 posts

    Hi,

    i was wondering if someone could give me a step by step on how i can allow a logged in user to access a page and no one else?

    Thanks in advance

    Max

  • #987 / Jul 13, 2011 10:19am

    Ben Edmunds

    812 posts

    maxrosecollins,

    if (!$this->ion_auth->logged_in())
    {
       show_error('You are not authorized to view this page.');
    }
  • #988 / Jul 13, 2011 11:58am

    gbar

    31 posts

    I wanted to point out some small things about auth controller. I started this morning to try this class.

    1) When I call the function forgot_password (), this shows the entry form email, but can not display the variable $identity, and not sends the mail. I solved by replacing the line 170, this code:

    $identity = $this->config->item('identity');

    with this:

    $identity = $this->config->item('identity', 'ion_auth');

    in this way is displayed the variable, and email is send

    2) Strange problem, when I send the email to reset the password, the code is correctly inserted in the database, but in the link within the email, the code is not there. If I send the email again, another code is inserted in the database, and a code appear in the link within mail, but is the precedent! So you can never be reset, because the codes will not match ever ...

    someone has the same problem?

    thanks

  • #989 / Jul 18, 2011 6:03am

    gbar

    31 posts

    no one has really had a similar problem? I also changed the server, I am not in charge ...

  • #990 / Jul 19, 2011 11:56am

    Shauna Gordon

    3 posts

    Hey Ben, great library.

    I think I found a bug, or at least potential refactor candidate, in ion_auth_model.

    On line 476, you have:

    // If username is taken, use username1 or username2, etc.
            if ($this->identity_column != 'username')
            {
            for($i = 0; $this->username_check($username); $i++)
            {
                if($i > 0)
                {
                $username .= $i;
                }
            }
            }

    As it is, if identity_column is set to email, it tries to check the username column. In a system that has a username column, but it’s set to the email, this would be okay, but in a system without a username column, this obviously breaks. Even if you assume the username column always exists, and require it in the database (which doesn’t seem like a good idea, if the column is effectively unused), by just setting the username = email, like you suggest in an earlier reply in this thread, in systems where the email is the only identifying column, the username would be unique by proxy (because the email has to be unique), thus rendering this code useless anyway.

    Or, is there a use case that you had in mind for this code that I’m missing?

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

ExpressionEngine News!

#eecms, #events, #releases