Welcome Guest, Not a member yet? Register   Sign In
The Easiest Authentication Library for CodeIgniter just got easier.
#81

[eluser]Adam Griffiths[/eluser]
The Authentication Library is actually writing the data from id and assigns it to a value in the session for user_id. So you can still grab the id out of the session data at any time.

Thanks.
#82

[eluser]Dregond Rahl[/eluser]
Hey Adam, iv been using your library for a project of mine and i noticed that even tho the cookie lasts for ever, the session still dies after 2 hours, and even if i have the cookie it asks me to login. =/
#83

[eluser]markbarratt[/eluser]
Anyone made a password reminder for this library? Or have a reasonably straightforward method to suggest?

It's the one thing missing from this excellent and very simple (in a good way) product.
#84

[eluser]seanloving[/eluser]
Adam,
thanks for building this Auth Library. Hopefully I can adapt it to more than one application.

This might be more of a CI question than a Auth Library question...

I modified your register.php (application/views/auth/pages folder) so it includes a select list as follows:
Code:
<input type="text" name="email" size="50" class="form" value="<?php echo set_value('email', $email); ?>" />
&lt;?php echo form_error('email'); ?&gt;<br /><br />
Group:<br />
   <select name="group_id">
     <option value="1">Admin</option>
     <option value="2">Sales</option>
     <option value="100">Customer</option>
   </select>

My Auth.php (application/config folder) contains the group definitions:
Code:
$config['auth_groups'] = array(
                            'admin' => '1',
                            'sales' => '2',
                            'customer' => '100'
                            );

Then, in the Auth.php (application/libraries folder) I am trying to use the set_select()
Code:
$username = set_value('username');
     $password = $this->_salt(set_value('password'));
     $email = set_value('email');
     //$group = set_select('group_id', '$this->CI->input->post(\'group_id\')');
     $group = $this->CI->input->post('group_id');
     echo $group;  //debug purposes
            
     if($edit === TRUE)
     {
          $this->CI->db->query("UPDATE `users` SET `email` = '$email' WHERE `id` = '$id'");
          $this->CI->db->query("UPDATE `users` SET `group_id` = '$group' WHERE `id` = '$id'");
          $data2['msg'] = "The user has now been edited.";
     }

Above, I want to use the second $group statement (commented out) not the first one. How can I make set_select() properly (re)calculate the value to display? When I use the set_select() the second parameter seems to returns a null (or something similar) because the error message seems to indicate the value is not coming through:
Code:
A Database Error Occurred

Error Number: 1366

Incorrect integer value: '' for column 'group_id' at row 1

UPDATE `users` SET `group_id` = '' WHERE `id` = '5'

Your set_value seems to be working fine, but my addition of set_select no workie.

Thanks

--Sean Loving
#85

[eluser]Adam Griffiths[/eluser]
Sean, since your dropdown menu is called group_id — wouldn't the way I've grabbed the group_id work anyway?

Yeah this is more of a CodeIgniter question than an Authentication Library question; and I'm not sure how you'd go about this other than throwing you over to the user guide I'm afraid I won't be much help with your problem.

Thanks,
Adam
#86

[eluser]SSgt Dodger USMC[/eluser]
Hi Adam!

Do you have an off-line version of your user-guide? I do a great deal of my development on systems without internet access, and that would be extremely useful.

Thanks anyway, even if you don't.
#87

[eluser]carnalito[/eluser]
Hi Adam,

i think there is another error in the library 'Auth.php' line 238:

Instead:
Code:
$data = array(
            'username' => $username,
            'user_id' => $row['id'],
            'group' => $row['group_id'],
            'logged_in' => TRUE
            );

it should be:
Code:
$data = array(
            'username' => $username,
            'user_id' => $row['id'],
            'group_id' => $row['group_id'],
            'logged_in' => TRUE
            );

Right?!

Regards

Carnalito
#88

[eluser]Adam Griffiths[/eluser]
[quote author="carnalito" date="1245714454"]Hi Adam,

i think there is another error in the library 'Auth.php' line 238:

Instead:
Code:
$data = array(
            'username' => $username,
            'user_id' => $row['id'],
            'group' => $row['group_id'],
            'logged_in' => TRUE
            );

it should be:
Code:
$data = array(
            'username' => $username,
            'user_id' => $row['id'],
            'group_id' => $row['group_id'],
            'logged_in' => TRUE
            );

Right?!

Regards

Carnalito[/quote]

I have fixed this error and it's in the Github repo. Here. The correct way to reference group is 'group' not 'group_id'.


Thanks.
#89

[eluser]carnalito[/eluser]
Hi Adam,

well seems a little weird, check line 145:

Code:
'group_id' => $row['group_id']

and in line 238 in the same context:

Code:
'group' => $row['group_id']

i would bet that one line of this two is not correct.
Maybe i am wrong...

Regards

Carnalito
#90

[eluser]Adam Griffiths[/eluser]
[quote author="carnalito" date="1245769364"]Hi Adam,

well seems a little weird, check line 145:

Code:
'group_id' => $row['group_id']

and in line 238 in the same context:

Code:
'group' => $row['group_id']

i would bet that one line of this two is not correct.
Maybe i am wrong...

Regards

Carnalito[/quote]

I have no idea why this is the case. My last commit to Github fixed this issue. I'll push all the files again.

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB