Post the Ion Auth library constructor, after you changed the paths. And a screenshot of your directory structure.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 10, 2010 7:00pm
Subscribe [287]#781 / Mar 01, 2011 4:09pm
Post the Ion Auth library constructor, after you changed the paths. And a screenshot of your directory structure.
#782 / Mar 01, 2011 4:30pm
Post the Ion Auth library constructor, after you changed the paths. And a screenshot of your directory structure.
I’ve attached a screen shot to my previous post, but I’ve had to shrink the whole thing, because of the attachment size limitations.
Here’s the constructor for your library file:
public function __construct() {
$this->CI =& get_instance();
$this->CI->load->config('users/ion_auth', TRUE);
$this->CI->load->library('email');
$this->CI->load->library('session');
$this->CI->lang->load('users/ion_auth');
$this->CI->load->model('users/ion_auth_model');
$this->CI->load->helper('cookie');
$this->messages = array();
$this->errors = array();
$this->message_start_delimiter = $this->CI->config->item('message_start_delimiter', 'ion_auth');
$this->message_end_delimiter = $this->CI->config->item('message_end_delimiter', 'ion_auth');
$this->error_start_delimiter = $this->CI->config->item('error_start_delimiter', 'ion_auth');
$this->error_end_delimiter = $this->CI->config->item('error_end_delimiter', 'ion_auth');
//auto-login the user if they are remembered
if (!$this->logged_in() && get_cookie('identity') && get_cookie('remember_code'))
{
$this->CI->ion_auth_model->login_remembered_user();
}
}#783 / Mar 03, 2011 5:25am
Hi Ben, any thoughts on the details I’ve given you in the previous two posts?
#784 / Mar 03, 2011 8:18am
I have troubles using authentication in postgre and keeping the user tables into a schema (not public):
$config['tables']['groups'] = 'provincia.webapp_groups';
$config['tables']['users'] = 'provincia.webapp_users';
$config['tables']['meta'] = 'provincia.webapp_meta';when i try lo login i call the get_users methond from the model
public function get_users($group=false, $limit=NULL, $offset=NULL)
{
$this->db->select(array(
$this->tables['users'].'.*',
$this->tables['groups'].'.name AS '. $this->db->protect_identifiers('group'),
$this->tables['groups'].'.description AS '. $this->db->protect_identifiers('group_description')
));
.
.
.but the first table is mis-escaped:
ERROR: syntax error at or near "".*, "" LINE 1: SELECT "provincia".webapp_users".*, "provincia"."webapp_grou… ^
SELECT "provincia".webapp_users".*, "provincia"."webapp_groups"."name" AS "group", "provincia"."webapp_groups"."description" AS "group_description", "provincia"."webapp_meta"."first_name", "provincia"."webapp_meta"."last_name", "provincia"."webapp_meta"."company", "provincia"."webapp_meta"."phone" FROM "provincia"."webapp_users" LEFT JOIN "provincia"."webapp_meta" ON "provincia"."webapp_users"."id" = "provincia"."webapp_meta"."user_id" LEFT JOIN "provincia"."webapp_groups" ON "provincia"."webapp_users"."group_id" = "provincia"."webapp_groups"."id" WHERE "provincia"."webapp_users"."id" = '1' LIMIT 1as you can see the first istance of the user table is: “provincia”.webapp_users”, missing a double quote. The next occurencies do not have the problem.
I’m unable to solve this myself (i started codeigniter yesterday), can you help me?
Thank you!!
#785 / Mar 06, 2011 7:04am
Hi there,
very neat Auth system. However, I noticed that you cannot change the name of the library when it’s being loaded.
$this->load->library('ion_auth', '', 'auth');You can’t do that due to requests to the library itself from the model (I specifically got some errors with $_extra_where variable, which is located in the library, but is being called by the model in numerous places).
This is not a major problem by any means, but I thought I should report this.
With regards,
Edmundas
#786 / Mar 06, 2011 6:39pm
@Wayne - did you get that figured out? I’m having the same problem with Reactor/Ion/ME.
The configuration file development/users/ion_auth.php and users/ion_auth.php do not exist.
#787 / Mar 07, 2011 7:31am
@Wayne - did you get that figured out?
No, I’m still awaiting a response from Ben.
I’ve looked at some of the example projects that people have suggested, but I just cannot make any sense of them, such is the dense structure of their layout and the extremely complex interlinking going on.
All very, very frustrating.
#788 / Mar 07, 2011 8:39am
I have just run the Ion_Auth application with Modular Extensions HMVC successfully.
Create a module named “auth” add the entire Ion_Auth application into the module. Move all of the views from the modules/auth/views/auth sub-directory up one level into modules/auth/views.
Call the application URL, http://domain.tld/index.php/auth and then login.
It works fine.
EDIT:
Removed the word “demo” to reduce ambiguity.
#789 / Mar 07, 2011 8:44am
I have just run the Ion_Auth demo with Modular Extensions HMVC successfully.
Create a module named “auth” add the entire Ion_Auth demo application into the module. Move all of the views from the modules/auth/views/auth sub-directory up one level into modules/auth/views.
Call the application URL, http://domain.tld/index.php/auth and then login.
It works fine.
What demo application are you referring to, or do you mean the actual Ion Auth download?
#790 / Mar 07, 2011 8:51am
Yes the application that is in the Ion_Auth download.
#791 / Mar 07, 2011 10:35am
Yes the application that is in the Ion_Auth download.
I had to throw everything away and start again, but I’ve not got Ion Auth working with your Modular Extensions, as far as the default “welcome” controller is concerned.
Assuming the whole thing is working properly, I’m good to go!
Thanks for your assistance on this. Always appreciated.
#792 / Mar 07, 2011 11:18am
I’m back to where I started, getting errors with every attempt I make to:
1. create a module, and;
2. add the library references for Ion Auth.
I want to call an Ion Auth method from the default controller (and from any other public controller from any other module), so I can validate the user:
function index() {
if (!$this->ion_auth->logged_in()):
// logic here…But I’m not even getting this far without encountering errors.
If I add library references as an autoload:
$autoload['libraries'] = array('database', 'session', 'auth/ion_auth');I get the error:
The configuration file auth/ion_auth.php does not exist.
If I add the reference as a module call into the constructor for the default controller referenced in “routes.php”:
$this->load->module('auth/ion_auth');I get the error:
Unable to load the requested class: ion_auth
If I try changing which core class my constructor is extending, to MY_Controller from MX_Controller, I get the same errors. If I try using the default class CI_Controller I get even more errors in addition to previously mentioned:
Message: Undefined property: CI::$form_validation
Filename: MX/Loader.php
Line Number: 166
As far as I can see, the errors are happening within the constructor for the Ion Auth library.
I’ve tried every permutation I can think of (routes, moving the modules directory, adding in the whole paths for the references et cetera) and none of them have worked.
Guys, I have no idea what’s going on. I simply cannot get any of this to work.
#793 / Mar 07, 2011 2:54pm
@Wayne: Are you trying to load ion_auth in your MY_Controller? I was/am having the same problem. I pulled ion_auth out of autoload and setup MY_Controller as shown below, I no longer receive the error.
class MY_Controller extends MX_Controller
{
public $data;
function __construct()
{
parent::__construct();
if ( ENVIRONMENT == 'development' )
{
$this->output->enable_profiler(TRUE); // debug onscreen
}
$this->benchmark->mark('my_controller_start');
log_message('debug', "*** MY_Controller initialized");
// Load the user and get user data
$CI =& get_instance();
$CI->load->library('users/ion_auth');
$this->user = $this->ion_auth->get_user();
$this->benchmark->mark('my_controller_end');
}
}I have a crap load more to do in the app, so it is not 100% the method above is my final solution. But I no longer receive an error.
EDIT: Had to add $data var to controller. Was producing error in MX Controller looking for CI $data var. Not sure why.
#794 / Mar 07, 2011 5:54pm
Hi guys,
Is there a way to change login with method on the fly? For example my app has only email login, but I want to enable users to login with their username as well. Is there any known way or I have to hack through the ion auth code to make this work?
Thanks in advance.
#795 / Mar 08, 2011 6:10am
@Wayne: Are you trying to load ion_auth in your MY_Controller? I was/am having the same problem. I pulled ion_auth out of autoload and setup MY_Controller as shown below, I no longer receive the error.
No, I’m calling Ion Auth from the default controller:
function index() {
if (!$this->ion_auth->logged_in()):
// logic here…But I’m not getting this far because Ion Auth is generating errors when I try to auto load it.
I simply cannot get any of this to work at all. I’ve spent hours trying all of the permutations I can think of and none of them work.