Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter

[eluser]Dave Morton[/eluser]
I first want to express my thanks for this terrific script. It beats the heck out of the way I used to do user authentication in the past. Many kudos! Smile

I'm somewhat reluctant to ask for assistance here, mainly because I know that the issue I'm having is self inflicted, but I've got a rather large angry welt on my forehead that isn't likely to go away soon unless I get past this, so here goes:

I'm porting a version of Program O (an internet chatbot script of which I'm the lead developer) over to a greatly modified version of CodeIgniter (mainly folder relocation and renaming), and I'm using Flexi Auth as the foundation for an optional "membership system". The CI part works great so far, and up until now, Flexi Auth has been playing well with the script. During the porting/creation process, I've had several of the issues that are mentioned in this thread (cookie data mismatch, not defining $this->auth as a stdClass, etc.), and this thread has helped me to resolve those issues nicely. So far, so good. Just a little more background, and I'll present my issue.

Part of this port involves a self-configuring install script that re-writes several config files (the config, autoload, database, routes and flexi_auth config files), altering or adding settings relevant to the installation, and this works quite well in testing. The script even successfully inserts a new admin user that is already activated to the proper table (verified via phpMyAdmin) without a hitch. The problem starts after this step, in that I get the following error message:

Quote:A Database Error Occurred

Error Number: 1054

Unknown column 'user_accounts.username' in 'field list'

SELECT `user_accounts`.`username`, `user_accounts`.`uacc_activation_token` FROM (`user_accounts`) LEFT JOIN `user_groups` ON `user_accounts`.`uacc_group_fk` = `user_groups`.`ugrp_id` LEFT JOIN `demo_user_profiles` ON `user_accounts`.`uacc_id` = `demo_user_profiles`.`upro_uacc_fk` LEFT JOIN `demo_user_address` ON `user_accounts`.`uacc_id` = `demo_user_address`.`uadd_uacc_fk` WHERE `user_accounts`.`uacc_id` = 6 GROUP BY `user_accounts`.`uacc_id`

Filename: D:\HTTP\Program-O\CI\core\database\DB_driver.php

Line Number: 330

Now I'm savvy enough with PHP to understand the problem, but new enough to CI and Flexi Auth to be baffled by where the error is being generated. I've checked and verified that the config settings are correct (listed below), and not pointing to a non-existent column in the DB table (I'm using the table structure and config from the demo, which I'm able to use without a problem), and I haven't modified any of the Flexi Auth controllers or models at all, so I'm confused as to how it could be trying to select from a DB column that doesn't exist. Here is (what I feel is) the relevant code:

Code:
// config/flexi_auth.php

$config['database']['user_acc']['columns']['username'] = 'uacc_username';
$config['database']['user_acc']['columns']['password'] = 'uacc_password';


// controllers/install.php (the initial primary controller - changed to another upon successful installation)

      # let's see if the admin wants to set up the membership system, and if so, add an admin account
      if((bool) $post['use_membership'])
      {
        $this->auth = new stdClass;
        $this->load->library('flexi_auth');
        $email = $post['debugemail'];
        $username = $post['adm_dbu'];
        $password = $post['adm_dbp'];
        $user_data = null;
        $group_id = 3;
        $activate = 1;
        $user_data = null;

        $success = $this->flexi_auth->insert_user($email, $username, $password, $user_data, $group_id, $activate);
        if (!$success)
        {
          exit(' Error = ' . $this->flexi_auth->error_messages());
          $this->session->set_userdata('error', $this->flexi_auth->error_messages());
          return $this->index();
        }
        redirect('install/membership');
      }

Please note that for now, install/membership only renders a test page, and does nothing further with Flexi Auth. I can provide more details as necessary, of course.

As you can see, there's nothing even remotely close to the "keyword" of 'username' in that portion of the script, and a search through the entire project for that word that might indicate a problem only shows up as an array index in the flexi_auth config file, and the value for that array element is 'uacc_username', so I'm stumped. Has anyone seen this before? And if so, what must I do to correct it?

Thanks. Smile


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 11-30-2013, 02:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB