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
|
RE: Community Auth - a database error when logging in - arie55 - 05-21-2017 I have installed Community Auth with CodeIgniter 3.1.4 and I got the same error : Quote:Column 'id' cannot be null [...] Filename: third_party/community_auth/models/Auth_model.php Line Number: 90 After reading this thread, I checked my CI session configuration (it was OK) and then, I started to debug. It seems that after this line (libraries/Authentication.php:693 PHP Code: $session_id = $this->CI->session->sess_regenerate( config_item('sess_regenerate_destroy') ); But, if I replace this line by : PHP Code: $this->CI->session->sess_regenerate( config_item('sess_regenerate_destroy') ); Do you have any idea why I get this error ? RE: Community Auth - a database error when logging in - skunkbad - 05-22-2017 (05-21-2017, 10:44 AM)arie55 Wrote: I have installed Community Auth with CodeIgniter 3.1.4 and I got the same error : What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key? RE: Community Auth - a database error when logging in - arie55 - 05-22-2017 (05-22-2017, 07:49 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key? Thanks for your reply ! My session config : PHP Code: $config['sess_driver'] = 'files'; base_url is set (I use it with the url helper) and the encryption key is set like this : PHP Code: $config['encryption_key'] = hex2bin('8ef3f3cf7643c5d5a29e307c0c1714f4'); RE: Community Auth - a database error when logging in - skunkbad - 05-22-2017 (05-22-2017, 10:08 AM)arie55 Wrote:Instead of(05-22-2017, 07:49 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key? Code: sys_get_temp_dir() You need to prove that regular CI sessions are working, because if they are you wouldn't have this problem. RE: Community Auth - a database error when logging in - kwat3173 - 05-22-2017 (05-22-2017, 01:31 PM)skunkbad Wrote:(05-22-2017, 10:08 AM)arie55 Wrote:Instead of(05-22-2017, 07:49 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key? Here is how I got mine to work. Step 1: Download Codeigniter 3.1.4 from there website. Step 2: Goto phpmyadmin and create a database. Step 3 Open config/config.php and edit the following: * base_url must point to your server since I am using localhost mine will be 'http://localhost/auth/' * index_page remove the 'index.php' so that it just shows '' * enable_hooks should be set to TRUE * encryption_key we will skip this and come back to it later * sess_driver change it to 'database' * sess_save_path remove NULL and enter 'ci_sessions' * global_xss_filtering change that to TRUE Step 4: Now go to phpadmin and click on your database then click on SQL and run the following code: CREATE TABLE IF NOT EXISTS `ci_sessions` ( `id` varchar(128) NOT NULL, `ip_address` varchar(45) NOT NULL, `timestamp` int(10) unsigned DEFAULT 0 NOT NULL, `data` blob NOT NULL, KEY `ci_sessions_timestamp` (`timestamp`) ); After that completed click on SQL again and run the following: ALTER TABLE ci_sessions ADD PRIMARY KEY (id); Step 5: Now go to config/database.php and enter the details for your database Step 6: Now open config/autoload.php and edit the following: * in libraries add the 'session', 'database', 'email' ---NOW TIME TO INSTALL COMMUNITY AUTH------ Step 1: Download community auth from there site and extract the contents Step 2: open the extracted folder click on skunkbad-community-auth-for-codeigniter-3-28955ea80f13 ->application->third_party and select the communtiy_auth folder and copy that into your_codeigniter_directory->application->third_party Step 3: Go to your_codeigniter_directory->third_party->community_auth. Go ahead and open the community_auth folder. Step 4: Select the following folders and copy them * config * controllers * core * helpers * hooks * libraries * models * views Then go to your_codeigniter_directory->application and right click and select paste. Step 5: go to phpmyadmin and import the sql file located in third_party->community_auth->sql The name of the file will be install.sql Step 6: next go to config/routes.php and add the following at the bottom: $route[LOGIN_PAGE] = 'examples/login' Step 7: Now goto config/hooks.php and add the following: $hook['pre_system'] = array( 'function' => 'auth_constants', 'filename' => 'auth_constants.php', 'filepath' => 'hooks' ); $hook['post_system'] = array( 'function' => 'auth_sess_check', 'filename' => 'auth_sess_check.php', 'filepath' => 'hooks' ); Step 8: Go to your_codeigniter_directory you should see your application folder and system folder. In here you are going to create a .htaccess file and add the following: # MAKE SURE TO LEAVE THE DENY LIST AT THE TOP OF THE FILE !!! # BEGIN DENY LIST -- # END DENY LIST -- RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] This will remove the index.php from the url Step 9: goto http://your_codeigniter_directory/key_creator so that you can generate the key encryption Here I just selected the codeigniter standard 128 bit encryption. This one will be located at the very top of the list. A new page will open giving you the key copy the entire key Now go back to config/config.php and enter that key into the encryption_key filed. I just normall paste it and add // in front of the old one to comment it out. Step 10: Now go to application->controller->Examples.php and edit line 195, 196, and 197 with your details to create the admin account. Make sure that you change auth_level = '9' Step 11: now go to url http://your_codeigniter_directory/examples/create_user you will see a message showing that the user has been created Step 12: now go to http://your_codeigniter_directory/examples/ you should get a message saying that your logged in Step 13: now go to http://your_codeigniter_directory/examples/logout That will log you out. RE: Community Auth - a database error when logging in - skunkbad - 05-22-2017 Guys, if you're on Linux or Mac, the dev installer script is awesome. Full install is accomplished in about 5 seconds. I'm not kidding. RE: Community Auth - a database error when logging in - kwat3173 - 05-22-2017 For those still having problems I created a repository that has codeigniter 3 and community auth installed. https://bitbucket.org/kwat3173/codeigniter-with-community-auth/downloads/ |