Community Auth - a database error when logging in - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7) +--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13) +--- Thread: Community Auth - a database error when logging in (/showthread.php?tid=67797) Pages:
1
2
|
Community Auth - a database error when logging in - icteroo - 04-10-2017 Hi, I have installed Community Auth (current master) with CodeIgniter 3.1.4. The configurations are: Code: $config['sess_driver'] = 'files'; Added an encryption key using Key_creator.php Edited Examples.php Code: public function create_user() An account is created using /examples/create_user Checked the DB user table and the user exists However when I try to login, I get a database error: A Database Error Occurred Error Number: 1048 Column 'id' cannot be null INSERT INTO `auth_sessions` (`id`, `user_id`, `login_time`, `ip_address`, `user_agent`) VALUES (NULL, '309003055', '2017-04-10 14:11:54', '84.92.55.111', 'Chrome 57.0.2987.133 on Mac OS X') Filename: third_party/community_auth/models/Auth_model.php Line Number: 90 $session_id seems to be NULL.. Do you have any idea why it keeps getting this error? Thanks. RE: Community Auth - a database error when logging in - skunkbad - 04-10-2017 Can you verify that the session actually exists in the location you are attempting to store it? sys_get_temp_dir() is your location. The id of auth_sessions is the CI session ID, and it's only NULL because that's what's being passed to it from the CI session library. My advice is to make sure plain CI sessions are working with your application, and you'll probably see that Community Auth starts working. RE: Community Auth - a database error when logging in - icteroo - 04-11-2017 Thanks for your reply. I have tested with the following: Code: public function test() and I got the result: in the browser http://mydomain.com/welcome/test array(4) { ["__ci_last_regenerate"]=> int(1491940229) ["auth_identifiers"]=> string(81) "a:2:{s:7:"user_id";s:9:"309003055";s:10:"login_time";s:19:"2017-04-11 19:55:38";}" ["username"]=> string(8) "testuser" ["logged"]=> bool(true) } on the server Code: /tmp $ sudo cat ci_sessionvg3kcrpgn7i2h0jggdbvm1j4ed64u7li I think CI session is working fine... RE: Community Auth - a database error when logging in - icteroo - 04-11-2017 The server is running Debian wheezy, nginx-1.2.1-2.2+wheezy4, php5-fpm-5.4.45-0+deb7u6, mysql-server-5.5.54-0+deb7u1 Is there anything to do with nginx? like rewrite configuration? Thanks. RE: Community Auth - a database error when logging in - skunkbad - 04-11-2017 When I use your session config, all is working fine. This is on Ubuntu 16.04 with PHP7. What is the value of your encryption key? Mine in example is like this: PHP Code: $config['encryption_key'] = hex2bin('5d3a06b1a1efeb861ad761fb8839794f'); RE: Community Auth - a database error when logging in - icteroo - 04-11-2017 (04-11-2017, 03:18 PM)skunkbad Wrote: When I use your session config, all is working fine. This is on Ubuntu 16.04 with PHP7. Mine is Code: $config['encryption_key'] = hex2bin('31a953d513fa2c32ae58b5520b495745'); RE: Community Auth - a database error when logging in - skunkbad - 04-11-2017 If you can zip up your site, and include a current dump of your database, and make it accessible for me to download, I'd like to figure out what's going on. I'd be glad to do it. RE: Community Auth - a database error when logging in - icteroo - 04-12-2017 https://drive.google.com/open?id=0B1uR0m6wwIyxdDdybFpnbDA1X2M Thanks! RE: Community Auth - a database error when logging in - skunkbad - 04-12-2017 This is what I had to do with your files to get things working: 1) Set the value of base_url in config/config to an actual domain. 2) Changed "admin" on line 41 of controllers/Examples.php to "superuser". You changed the names of the roles in config/authentication, but they are not appropriate for the examples. If you want to use the examples without altering them, then you need to change your roles back to the way they come from the Community Auth repo. That's all it took for me to get it working. Also, if you want to confirm things are just the way they are on my system (Ubuntu 16.04), then you can use the dev installer located at /community_auth/sh/.development_install.sh. I put that in /var/www, and then run it. I have a complete working install in about 5 seconds. I am of course using virtual hosts... but its worth a try to see if it works for you. RE: Community Auth - a database error when logging in - icteroo - 05-02-2017 Re-installed everything from scratch and it works fine. Thanks a lot for your help and great code!! |