CodeIgniter Forums
Having a bit of trouble working with redux auth - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Having a bit of trouble working with redux auth (/showthread.php?tid=18200)



Having a bit of trouble working with redux auth - El Forum - 04-28-2009

[eluser]intoitdaily[/eluser]
Alright, so I downloaded the redux auth system from googlecode and before I added the 'module' so to speak to my existing site that I'm working on, I decided to just become familiar with it by installing the EXAMPLE site that comes with the installation as its own separate site altogether. I hope everyone understands what I'm talking about.

So, I installed it, created the database and tables, yadda yadda. Now, I go to register an account, and when I click 'submit' it brings me a couple of errors at http://localhost/ci_redux/index.php/welcome/register...
Code:
A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: models/redux_auth_model.php

Line Number: 505
A Database Error Occurred

Error Number: 1048

Column 'group_id' cannot be null

INSERT INTO `users` (`username`, `password`, `email`, `group_id`, `ip_address`) VALUES ('fooname', 'e181ee8d4c889111211e26d8f472ff16d2d484c3', '[email protected]', NULL, '127.0.0.1')

I'm new to codeigniter but inspecting the code from this app I've been learning some tricks and tips. However, I'm not good enough at CI, nor am I familiar enough with auth redux to know what this error is, or how to fix it. Can anyone shed some light on this? Thanks!


Having a bit of trouble working with redux auth - El Forum - 04-28-2009

[eluser]slowgary[/eluser]
I'm not familiar with redux auth but generally in auth systems a user would belong to a group. Common sets of permissions are 'grouped' and users just belong to that group, as opposed to setting permissions on a per user basis.

The error is telling you straight out what the problem is:
Code:
Column 'group_id' cannot be null

Your users table has a field called 'group_id' and that field is made so that it is not allowed to be NULL (NULL means no value). So the redux auth does not allow you to create a user without assigning that user to a group. If you're using a frontend for creating this user, make sure you've first created a group to assign the user to before you create the user.

EDIT: Look at the SQL you posted - the 4th parameter in the INSERT is 'group_id' and the 4th parameter in VALUES is NULL. So you're trying to pass NULL for 'group_id' and once again, 'group_id' cannot be null.