Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]Andy78[/eluser]
Although I had set the validation rules in form on the page and in the widget to different validation groups It seems that form validation was running on both the form and widget when only the form in the page was submitted. With advice from ben I made sure that the both forms were separated into different variables and that the forms were also uniquely named. I had not named the forms and I think this is what was causing the problem
Code:
<?php
        $attributes = array('name' => 'create_account');
        echo form_open("auth/create_account", $attributes );?>

although I cant be 100% sure as I cant seem to replicate the problem I was having....

Thanks for your help on IRC ben..no doubt Ill probably harass you again sometime Wink

[eluser]Unknown[/eluser]
Bernd, I'm getting the exact same error when using Ion Auth and the latest tip version of CI2.

Maybe they've changed the load order? The version from ~October 12 was working fine.

[eluser]Andy78[/eluser]
I now have the problem back with the forgot password screen. I did everything that seemed to solve the problem before yet its still showing "Incorrect username or password. Please try again." in the widget after refresh.
Strange issue

[eluser]Timothy_[/eluser]
Hello,

I appologise if this has been posted already, I have tried searching but I don't have time to read 63 pages!

I am registering a user in my own controller using:

Code:
$this->ion_auth->register($username, $password, $email, $additional_data, $group_name)

How can I retrieve the user_id of the user I just created back from the model?

I appreciate your help.

Thanks,

Tim

[eluser]Devon Lambert[/eluser]
[quote author="Timothy_" date="1290426019"]Hello,

I appologise if this has been posted already, I have tried searching but I don't have time to read 63 pages!

I am registering a user in my own controller using:

Code:
$this->ion_auth->register($username, $password, $email, $additional_data, $group_name)

How can I retrieve the user_id of the user I just created back from the model?

I appreciate your help.

Thanks,

Tim[/quote]

Hi Tim,

There are few different ways to go about the retrieval but it depends on what you're trying to achieve?

Looking through the code, the register function will return the user_id of the last created user OR false, if there was an error for some reason.

Hope this helps?

- Devon

[eluser]Timothy_[/eluser]
Hello Devon,

Thanks for replying.

I have to add some more data to my DB specific to the user right after registering them. I don't have a lot of experience in passing data back from the model so i'm pretty lost...

Is there a code example you could point me towards?

Thanks,

Tim Mohr

[eluser]Devon Lambert[/eluser]
[quote author="Timothy_" date="1290436403"]Hello Devon,

Thanks for replying.

I have to add some more data to my DB specific to the user right after registering them. I don't have a lot of experience in passing data back from the model so i'm pretty lost...

Is there a code example you could point me towards?

Thanks,

Tim Mohr[/quote]

Unfortunately, I can't see any specific function provided by Ion_auth that provides this functionality to your controller. The register function lives within the library and returns the user_id. Someone else may have a better idea for getting at the user_id but it sounds like you may need to modify the library to get what your after.

Take a look at the below code found within the register function. You'll see how the devs were able to extract the user_id and store it in a variable to be passed in the event of email activation.

Found at line 320 in the Ion_auth library.
Code:
$activation_code = $this->ci->ion_auth_model->activation_code;
            $identity        = $this->ci->config->item('identity', 'ion_auth');
            $user            = $this->ci->ion_auth_model->get_user($id)->row();

            $data = array(
                'identity'   => $user->{$identity},
                'id'         => $user->id,
                'email'      => $email,
                'activation' => $activation_code,
            );

[eluser]Devon Lambert[/eluser]
[quote author="Ben Edmunds" date="1290069646"]Hey Bernd,

I'm not sure what's up with that error.

We're using Ion Auth with CI 2 in Pyro with no issues...


Let me know if I can help or if you figure out what's up. Are you using CI 2 from tip?[/quote]

Hey Ben,

Just another nod for Bernd's issue. I too am experiencing this issue with the latest/TIP clone from CI. I notice that in Pyro's dev branch you guys are still using the older CI code in the system folder? Perhaps this is why it is working for you with Pyro?

Will keep investigating.

[eluser]Ben Edmunds[/eluser]
Timothy_,

I ran into this problem the other day as well. I just pushed a change to the library so the register() method will return the newly created users id if the registration was successful, otherwise it will return false.

So an example of how you get the users id now is:

Code:
$user_id = $this->ion_auth->register(......

[eluser]Devon Lambert[/eluser]
All appears to be working ok now?

Strange, not really sure what I did. I updated my uri_protocol in my Config file, but hardly see how this could affect/change the error that was being thrown.

Also went back and re-downloaded the latest tip of CI from BitBucket. This is more likely to be where the solution came from, but I can't say for sure as I kept working on some other issues.

I'll keep an eye out and if this bug returns, I'll let the group know how I was able to resolve.




Theme © iAndrew 2016 - Forum software by © MyBB