• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
flexi auth - A user authentication library for CodeIgniter

I've been using this library for quite a while, it's awesome.

What would be the downside of using the native sessions instead of database? I've had so much trouble with the `ci_sessions` table, it's been soo slow, for each insert and update. I've tried so much fixes, but in the end I gave up. So I tried running the library on a native sessions, I haven't seen anything out of ordinary yet, but if you can let me know what would go wrong that would be great. Thanks and keep up the great work.


[quote author="haseydesign" date="1357181288"]


I'm guessing you may have solved this by now, but anyhow.
The problem you were getting is most likely that you hadn't defined the global '$this->auth' object prior to loading the library.

$this->auth = new stdClass;
$this->load->library('flexi_auth_lite', FALSE, 'flexi_auth');


Hello and thank you very much for this plugin Smile ! I have experienced same error message and added that "$this->auth = new stdClass;" line . (it fixed) . So, two questions i have :

1-) What's the meaning of this line $this->auth = new stdClass;
2-) It's not written on documentation. In documentation only thing to load library is $this->load->blabla. Why it is not in documentation ?

Thanks again and again and again Smile


If you don't mind, can you tell me why I keep getting this error whenever I want to update a password?

Your submitted password does not match our records.

[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:

// 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;
        $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();

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

[eluser]Dave Morton[/eluser]
In answer to my own post, above, I've found the problem and I feel like a yutz. :down:

In the file config/flexi_auth_install.php (the original file, but renamed to prevent "contamination" from a botched install), on line 230, I found this:

$config['database']['settings']['primary_identity_col'] = 'username';

By changing it to this:

$config['database']['settings']['primary_identity_col'] = 'uacc_username';

the problem went away. How I missed this is beyond me. :bug:

I know Flexi Auth does not support any third party api login -- But I was wondering if anyone had worked at integrating it with OAuth2?

Has anyone done this, or have any suggestions how difficult it might be to integrate?




how to prevent from bots creating new rows to ci_sessions table?

and is it possible to use nosql for ci_sessions table?

Follow the solution @ Stackoverflow. http://stackoverflow.com/questions/20077...ed-by-bots

[quote author="suthan" date="1386107866"]Follow the solution @ Stackoverflow. http://stackoverflow.com/questions/20077...ed-by-bots[/quote]

thanks for fast response suthan!

I'm hoping that someone can help me. I'm new to CodeIgniter and to Flexi Auth. I've got everything up and running using the demo files as a guide. Problem is, after I've logged in, if I hit refresh or go to a link, it kicks me back to the login. If I hit the refresh button, I get this DB error. Can someone explain to me what's going on and how to fix this issue?

Error Number: 1054

Unknown column 'user_login_sessions.usess_uacc_fk' in 'where clause'

DELETE FROM `hdb_v2_user_login_sessions` WHERE (user_login_sessions.usess_uacc_fk = '4' AND user_login_sessions.usess_series = 'a7e666807b8088e8f7e523b0385bd22e7735bf7e' AND user_login_sessions.usess_token = '1aef4011ed88fb2dc18ef027fcb72a8f2c275394') OR (user_login_sessions.usess_uacc_fk = '4' AND user_login_sessions.usess_token = '21f03cbfb7787a5964ad08b94a869ea66b0933d1')

Filename: /Volumes/Data/Users/username/Documents/Web Server/betaproject.domain/models/flexi_auth_lite_model.php

Line Number: 349

Nevermind, I figured it out. Some how the session preferences in the config file for timeouts got changed.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.