Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3 and FlexiAuth
#1

Hi All,

I have just updated my site to the latest version of Codeigniter 3 and have made the necessary changes to the ci_sessions table to take advantage of the new sessions table and have updated my config file.

I am having some issues when logging in with valid login credentials and am redirected back to the login page with no message being displayed instead of the correct page for logged in users.

When I check the database tables I can see a new entry for the ci_sessions table however if I manually try and navigate to the users part of the site I get the error that I do not have access which is indicating that the users session is not created correctly to login to the system.

Can anyone please assist with this.

Happy to provide snippets of code if needed please let me know what you would like me to paste a copy of.

I have followed the upgrade instructions to update my system folder with the entire new codeigniter 3 files.

I have been trying to wade through this for the last few days and get this all working for my site so will appreciate any pointers/help that you can give me on what to look for.
Reply
#2

Did you follow all of the upgrade instructions ( http://www.codeigniter.com/userguide3/in...e_300.html ) for your application code and the FlexiAuth code? It appears that someone has had some luck using FlexiAuth with CI 3 ( https://github.com/haseydesign/flexi-auth/issues/29 ), but it's not going to work without some changes.
Reply
#3

Hi mwhitney,

Thanks for your reply.

Yes I have followed the upgrade instructions and have seen that article and taken notice of those changes and applied to them and was able to get both working until I took a look further at the changes to the sessions library and it has changed the table schema for this table in 3.0 so I have applied the changes to the table ci_sessions and now I am experiencing the issue when trying to login with valid credentials I am redirected back to the login page.

Any further help you could give me would be greatly appreciated.

I am using flexiauth with the database sessions.

I have also updated my config file to use the new sessions config items and updated as required however it is not working.

I will try and look at the code further tonight to see what other changes I may need to apply to my application for any base files outside of the system folder as I haven't taken a look at these in detail apart from what was explicitly noted in the upgrade guide ie ucfirst naming.
Reply
#4

I have gone through my application and compared it against the Codeigniter 3 RC2 files and have made the necessary changes to update any files outside of the system folder that contained any content that needed to be updated bar any changes I have made to get my application to work ie database connection info.

I am still trying to sort this issue out further and would appreciate any further help that anyone could give me please.
Reply
#5

(This post was last modified: 02-06-2015, 04:35 AM by itconstruct.)

I am trying to debug this in my application however the usual way I know of debugging of echoing statements or var_dump is not working as well as I would like to understand the logic better and the path it is taking to determine what needs to be fixed.

Similar to the codeigniter error logging feature that shows debug, info and warning messages for PHP is there a way to output the logic of my application to a text file in verbose?

UPDATE:
I figured out how to add my own info to the error log will try this over the weekend and see if this helps:
http://www.codeigniter.com/userguide3/ge...rrors.html
Reply
#6

In most cases, the best method of getting this type of information is to profile your application with Xdebug ( http://www.xdebug.org/docs/profiler ). In some cases it can take some time to get Xdebug configured and working properly, but it's usually worth the effort in the long term.
Reply
#7

Hi Mwhitney,

Thanks for this advice.

Please allow me a few days to setup and configure Xdebug to identify and isolate this issue further if possible. It may also take me a little while to understand how to use Xdebug for this.

I will let you know how I go with this.
Reply
#8

I have finally been able to finish configuring and setting up Xdebug I can see how this will become a very powerful tool for me to use.

I have seen that the user's login is valid and I am redirected back to the login page and from here it should then take me further into the admin section of the site as I am using valid credentials however it remains on the login page instead and this is the part that I will need to try and isolate further to determine the issue.

Will let you know how I go.
Reply
#9

Hi Mwhitney,

I think I may have isolated the problem using Xdebug to the following line in my code:
if ($this->flexi_auth->is_logged_in_via_password() && uri_string() != 'login/logout') as I have both Codeigniter 3 (Development Environment) and Codeigniter 2 (Production Environment) to compare between.

I would like to try and see this information in the debugger in my case I am using PHPStorm as the IDE but I am not sure how to interpret Xdebug results for $this-> and determine what the results are of each of the parts of the if statement.

I was wondering if you had any pointers on what to look for on where I could find out this information?

It is getting quite late over here so will try and look at this further tomorrow and read up more about Xdebug and how to interpret and use the results.
Reply
#10

Determining these types of results in the debugger can sometimes be difficult, especially since both are the results of function/method calls rather than properties/variables. In this case, you can probably track down properties which those methods use to determine their value. For example, uri_string() is a helper function which references get_instance()->uri->uri_string(), which, in turn, simply returns the public $uri_string property of CI_URI. So, uri_string() should give you the same result as $this->uri->uri_string, as long as $this refers to the CI instance (if it doesn't, you can look for the CI instance, or even the $URI instance, in your debugger).

I would imagine the is_logged_in_via_password() method in flexi_auth does something similar (referencing a property set in flexi_auth when the user logs in).

Otherwise, you can pull the method call out of the if statement and assign the result to a variable, the value of which should be easier to find in the debugger.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB